]> gitweb.factorcode.org Git - factor.git/blob - extra/zealot/help-lint/help-lint.factor
factor: trim using lists
[factor.git] / extra / zealot / help-lint / help-lint.factor
1 ! Copyright (C) 2019 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs command-line help.lint io kernel namespaces
4 prettyprint sequences system vocabs ;
5 IN: zealot.help-lint
6
7 ! FIXME: help-lint sometimes lists monitors and event-streams as leaked.
8 ! event-stream is macosx-only so hack it into a string
9 CONSTANT: ignored-resources {
10     "linux-monitor" "macosx-monitor" "malloc-ptr"
11     "epoll-mx" "server-port" "openssl-context"
12     "cache-assoc" "input-port" "fd" "output-port" "stdin"
13     "event-stream"
14 }
15
16 : filter-flaky-resources ( seq -- seq' )
17     [ drop unparse ignored-resources member? ] assoc-reject ;
18
19 ! Allow testing without calling exit
20 : zealot-help-lint ( exit? -- )
21     command-line get require-all
22     help-lint-all
23     lint-failures get filter-flaky-resources
24     [ nip assoc-empty? [ "==== FAILING LINT" print :lint-failures flush ] unless ]
25     [ swap [ 0 1 ? (exit) ] [ drop ] if ] 2bi ;
26
27 : zealot-help-lint-main ( -- )
28     t zealot-help-lint ;
29
30 MAIN: zealot-help-lint-main