]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/help/lint/checks/checks.factor
core: subseq-index? -> subseq-of?
[factor.git] / basis / help / lint / checks / checks.factor
index e530e1306c4eecca67556e3bf490767f18479aba..dfac066116ed37f08d15db58316d03423f9f8fb9 100644 (file)
@@ -1,13 +1,12 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs classes classes.struct
-classes.tuple combinators combinators.short-circuit
-combinators.smart continuations debugger definitions effects
-eval formatting fry grouping help help.markup help.topics io
-io.streams.string kernel macros math math.statistics namespaces
-parser.notes prettyprint sequences sequences.deep sets splitting
-strings summary tools.destructors unicode vocabs vocabs.loader
-words words.constant words.symbol ;
+classes.tuple combinators combinators.short-circuit debugger
+definitions effects eval formatting grouping help help.markup
+help.topics io io.streams.string kernel macros math
+math.statistics namespaces prettyprint sequences sequences.deep
+sets splitting strings summary tools.destructors unicode vocabs
+vocabs.loader words words.constant words.symbol ;
 IN: help.lint.checks
 
 ERROR: simple-lint-error message ;
@@ -27,26 +26,21 @@ SYMBOL: vocab-articles
             "layout" ! ui.text.pango
             "script-string" ! windows.uniscribe
             "linux-monitor" ! github issue #2014, race condition in disposing of child monitors
+            "event-stream"
+            "macosx-monitor"
+            "recursive-monitor"
+            "input-port"
+            "malloc-ptr"
+            "fd"
         } member?
     ] reject ;
 
-: eval-with-stack ( str -- output )
-    [
-        [
-            parser-quiet? on parse-string [
-                output>array [
-                    nl "--- Data stack:" print stack.
-                ] unless-empty
-            ] call( quot -- )
-        ] [ nip print-error ] recover
-    ] with-string-writer ;
-
 : check-example ( element -- )
     [
         '[
             _ rest [
-                but-last "\n" join
-                eval-with-stack
+                but-last join-lines
+                (eval-with-stack>string)
                 "\n" ?tail drop
             ] keep
             last assert=
@@ -126,11 +120,6 @@ SYMBOL: vocab-articles
         simple-lint-error
     ] unless ;
 
-: check-nulls ( element -- )
-    \ $values swap elements
-    null swap deep-member?
-    [ "$values should not contain null" simple-lint-error ] when ;
-
 : check-see-also ( element -- )
     \ $see-also swap elements [ rest all-unique? ] all?
     [ "$see-also are not unique" simple-lint-error ] unless ;
@@ -158,7 +147,7 @@ SYMBOL: vocab-articles
             simple-lint-error
         ] when
     ] [
-        "  " swap subseq? [
+        "  " subseq-of? [
             "Paragraph text should not contain double spaces"
             simple-lint-error
         ] when