6.2.901.900
Documentation Coverage
This library provides functions for inspecting the number of
bindings a module exports with and without corresponding
Scribble documentation, as well as Rackunit tests based on
this information. This allows a module author to enforce in
a test suite that their modules provide no undocumented
bindings.
source code: https://github.com/jackfirth/doc-coverage
1 Basic Module Documentation Reflection
These primitives for examining module documentation information
allow the construction of tests and reflection tools. They are
implemented with Racket’s native module reflection functions
combined with Scribble’s xref? tables.
Returns #t if the module mod provides
binding with documentation, and #f
otherwise.
Returns a list of all bindings exported by
mod.
Similar to
module->exports, but provides no
phase level information and lists both value bindings
and syntax bindings.
Example: |
> (module->all-exported-names 'racket/match) | '(legacy-match-expander? | match-...-nesting | match-expander? | prop:legacy-match-expander | prop:match-expander | syntax-local-match-introduce | exn:misc:match? | match-equality-test | == | define-match-expander | define/match | failure-cont | match | match* | match*/derived | match-define | match-define-values | match-lambda | match-lambda* | match-lambda** | match-let | match-let* | match-let*-values | match-let-values | match-letrec | match-letrec-values | match/derived | match/values | struct*) |
|
|
Returns a list of only the bindings exported by mod
with Scribble documentation.
Example: |
> (module->documented-exported-names 'racket/match) | '(legacy-match-expander? | match-expander? | prop:legacy-match-expander | prop:match-expander | syntax-local-match-introduce | exn:misc:match? | match-equality-test | == | define-match-expander | define/match | failure-cont | match | match* | match*/derived | match-define | match-define-values | match-lambda | match-lambda* | match-lambda** | match-let | match-let* | match-let*-values | match-let-values | match-letrec | match-letrec-values | match/derived | match/values | struct*) |
|
|
Returns a list of only the bindings exported by mod
without Scribble documentation.
2 Module Documentation Statistics
These procedures are simple numeric tools built on the core
module documentation reflection functions.
Returns the percentage of bindings in mod that are
documented.
3 Testing Module Documentation
These Rackunit checks allow flexible specification of requirements
of a modules documentation, including require all exports be documented,
only specific exports, or that a module overall document a minimum
percentage of its exports.
Fails if mod does not document all of its exports,
listing any undocumented exports in the failure message.
Example: |
> (check-all-documented 'racket/base) | -------------------- | FAILURE | name: check-all-documented | location: (eval 12 0 12 1) | expression: (check-all-documented (quote racket/base)) | params: (racket/base) |
| Module racket/base has 3 undocumented bindings: |
| expand-for-clause | for-clause-syntax-protect | syntax-pattern-variable? | -------------------- |
| |
|
Fails if mod does not provide and document
binding.
Examples: |
> (check-documented 'racket/list 'second) | | > (check-documented 'racket/match 'match-...-nesting) | -------------------- | FAILURE | name: check-documented | location: (eval 14 0 14 1) | expression: (check-documented (quote racket/match) (quote match-...-nesting)) | params: (racket/match match-...-nesting) |
| Module racket/match does not document binding match-...-nesting | -------------------- |
| |
|
Fails if mod does not document at least ratio
of its provided bindings.
Example: |
> (check-documentation-ratio 'racket/match 0.99) | -------------------- | FAILURE | name: check-documentation-ratio | location: (eval 15 0 15 1) | expression: (check-documentation-ratio (quote racket/match) 0.99) | params: (racket/match 0.99) |
| Module racket/match does not document at least 99.0% of its bindings, only documents 96.55172413793103% | -------------------- |
| |
|