]> gitweb.factorcode.org Git - factor.git/commitdiff
help.lint.checks: Save lint disposables in hash.
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 7 Jul 2018 16:14:16 +0000 (11:14 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 7 Jul 2018 16:14:16 +0000 (11:14 -0500)
basis/help/lint/checks/checks.factor

index 47a4c6a43f840a7d302761ed00caf0ba63583b64..a10315bb4ce0c7f5ba170fb0e81d862b710bbcfd 100644 (file)
@@ -4,10 +4,10 @@ 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 namespaces parser.notes
-prettyprint sequences sequences.deep sets splitting strings
-summary tools.destructors unicode vocabs vocabs.loader words
-words.constant words.symbol ;
+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 ;
 IN: help.lint.checks
 
 ERROR: simple-lint-error message ;
@@ -50,9 +50,13 @@ SYMBOL: vocab-articles
             ] keep
             last assert=
         ] vocabs-quot get call( quot -- )
-    ] leaks members no-ui-disposables length [
-        "%d disposable(s) leaked in example" sprintf simple-lint-error
-    ] unless-zero ;
+    ] leaks members no-ui-disposables
+    dup length 0 > [
+       dup [ class-of ] histogram-by
+       [ "Leaked resources: " write ... ] with-string-writer simple-lint-error
+    ] [
+        drop
+    ] if ;
 
 : check-examples ( element -- )
     \ $example swap elements [ check-example ] each ;