adjust check-docs so that the skipped exports are a parameter

This commit is contained in:
Robby Findler 2011-04-26 15:46:50 -05:00
parent dc0198a784
commit 06ed2045ae
2 changed files with 30 additions and 9 deletions

View File

@ -3,7 +3,7 @@
(check-docs (quote plai/web))
(check-docs (quote plai/test-harness))
(check-docs (quote plai/random-mutator))
(check-docs (quote plai/mutator))
(check-docs (quote plai/mutator) #:skip #rx"^#%")
(check-docs (quote plai))
(check-docs (quote plai/datatype))
(check-docs (quote plai/collector))

View File

@ -8,8 +8,29 @@
;; checks to make sure that all of the exports of
;; the 'what' library are documented
(provide/contract [check-docs (-> symbol? any)])
(define (check-docs what)
(provide/contract [check-docs (->* (symbol?)
(#:skip (or/c regexp?
symbol?
#f
(-> symbol? any)
(listof (or/c regexp? symbol?))))
any)])
(define (check-docs what #:skip [skip #f])
(define (skip-proc f)
(cond
[(regexp? skip)
(regexp-match skip (symbol->string f))]
[(procedure? skip)
(skip f)]
[(not skip) #f]
[(list? skip)
(for/or ([x (in-list skip)])
(cond
[(regexp? x)
(regexp-match skip (symbol->string f))]
[(symbol? x)
(eq? x f)]))]))
(define pieces (regexp-split #rx"/" (symbol->string what)))
(cond
[(null? pieces) (error 'get-docs "bad arg ~s" what)]
@ -38,7 +59,9 @@
"~a_scm.zo"))
(if file
(call-with-input-file file read)
(k '() '()))))))
(begin
(eprintf "did not find compiled file for ~s\n" what)
(k '() '())))))))
(define (get n info)
(define a (assoc n info))
@ -51,15 +74,13 @@
(define undocumented-exports
(for/list ([ex (in-list exports)]
#:when ;; skip #%module-begin, #%top, etc.
(not (regexp-match #rx"^#%" (symbol->string ex)))
#:when ;; skip deserialization library stuff
(not (regexp-match #rx"^deserialize-info:" (symbol->string ex)))
#:when
(not (xref-binding->definition-tag
xref
(list what ex)
#f)))
#f))
#:when
(not (skip-proc ex)))
ex))
(unless (null? undocumented-exports)