Merge git://factorcode.org/git/factor
commit
6ded6740fe
|
@ -1,13 +0,0 @@
|
|||
USING: alien alien.c-types calendar calendar.unix
|
||||
kernel math tools.test ;
|
||||
|
||||
[ t ] [ 239293000 [
|
||||
unix-time>timestamp timestamp>timeval
|
||||
timeval>timestamp timestamp>timeval *ulong
|
||||
] keep = ] unit-test
|
||||
|
||||
|
||||
[ t ] [ 23929000.3 [
|
||||
unix-time>timestamp timestamp>timeval
|
||||
timeval>timestamp timestamp>timeval *ulong
|
||||
] keep >bignum = ] unit-test
|
|
@ -1,26 +1,26 @@
|
|||
USING: help.markup help.syntax ;
|
||||
IN: help.lint
|
||||
|
||||
HELP: check-help
|
||||
{ $description "Checks all word and article help." } ;
|
||||
HELP: help-lint-all
|
||||
{ $description "Checks all word help and articles in all loaded vocabularies." } ;
|
||||
|
||||
HELP: check-vocab-help
|
||||
HELP: help-lint
|
||||
{ $values { "vocab" "a vocabulary specifier" } }
|
||||
{ $description "Checks all word help in the given vocabulary." } ;
|
||||
{ $description "Checks all word help and articles in the given vocabulary and all child vocabularies." } ;
|
||||
|
||||
ARTICLE: "help.lint" "Help lint tool"
|
||||
"The " { $vocab-link "help.lint" } " vocabulary implements a tool to check documentation in an automated fashion. You should use this tool to check any documentation that you write."
|
||||
$nl
|
||||
"To run help lint, use one of the following two words:"
|
||||
{ $subsection check-help }
|
||||
{ $subsection check-vocab-help }
|
||||
{ $subsection help-lint }
|
||||
{ $subsection help-lint-all }
|
||||
"Help lint performs the following checks:"
|
||||
{ $list
|
||||
"ensures examples run and produce stated output"
|
||||
{ "ensures " { $link $see-also } " elements don't contain duplicate entries" }
|
||||
{ "ensures " { $link $vocab-link } " elements point to modules which actually exist" }
|
||||
{ "ensures that " { $link $values } " match the stack effect declaration" }
|
||||
{ "ensures that word help articles actually render (this catches broken links, improper nesting, etc)" }
|
||||
{ "ensures that help topics actually render (this catches broken links, improper nesting, etc)" }
|
||||
} ;
|
||||
|
||||
ABOUT: "help.lint"
|
||||
|
|
|
@ -5,7 +5,7 @@ words strings classes tools.browser namespaces io
|
|||
io.streams.string prettyprint definitions arrays vectors
|
||||
combinators splitting debugger hashtables sorting effects vocabs
|
||||
vocabs.loader assocs editors continuations classes.predicate
|
||||
macros combinators.lib ;
|
||||
macros combinators.lib sequences.lib ;
|
||||
IN: help.lint
|
||||
|
||||
: check-example ( element -- )
|
||||
|
@ -84,7 +84,7 @@ M: help-error error.
|
|||
delegate error. ;
|
||||
|
||||
: check-something ( obj quot -- )
|
||||
over . flush [ <help-error> , ] recover ; inline
|
||||
flush [ <help-error> , ] recover ; inline
|
||||
|
||||
: check-word ( word -- )
|
||||
dup word-help [
|
||||
|
@ -106,22 +106,45 @@ M: help-error error.
|
|||
[ dup check-rendering ] assert-depth drop
|
||||
] check-something ;
|
||||
|
||||
: check-articles ( -- )
|
||||
articles get keys [ check-article ] each ;
|
||||
: group-articles ( -- assoc )
|
||||
articles get keys
|
||||
vocabs [ dup vocab-docs-path swap ] H{ } map>assoc
|
||||
H{ } clone [
|
||||
[
|
||||
>r >r dup >link where ?first r> at r> [ ?push ] change-at
|
||||
] 2curry each
|
||||
] keep ;
|
||||
|
||||
: with-help-lint ( quot -- )
|
||||
: check-vocab ( vocab -- seq )
|
||||
"Checking " write dup write "..." print
|
||||
[
|
||||
dup words [ check-word ] each
|
||||
"vocab-articles" get at [ check-article ] each
|
||||
] { } make ;
|
||||
|
||||
: run-help-lint ( prefix -- alist )
|
||||
[
|
||||
all-vocabs-seq [ vocab-name ] map "all-vocabs" set
|
||||
call
|
||||
] { } make [ nl error. ] each ; inline
|
||||
articles get keys "group-articles" set
|
||||
child-vocabs
|
||||
[ dup check-vocab ] { } map>assoc
|
||||
[ nip empty? not ] assoc-subset
|
||||
] with-scope ;
|
||||
|
||||
: check-help ( -- )
|
||||
[ all-words check-words check-articles ] with-help-lint ;
|
||||
: typos. ( assoc -- )
|
||||
dup empty? [
|
||||
drop
|
||||
"==== ALL CHECKS PASSED" print
|
||||
] [
|
||||
[
|
||||
swap vocab-heading.
|
||||
[ error. nl ] each
|
||||
] assoc-each
|
||||
] if ;
|
||||
|
||||
: check-vocab-help ( vocab -- )
|
||||
[
|
||||
child-vocabs [ words check-words ] each
|
||||
] with-help-lint ;
|
||||
: help-lint ( prefix -- ) run-help-lint typos. ;
|
||||
|
||||
: help-lint-all ( -- ) "" help-lint ;
|
||||
|
||||
: unlinked-words ( words -- seq )
|
||||
all-word-help [ article-parent not ] subset ;
|
||||
|
@ -132,4 +155,4 @@ M: help-error error.
|
|||
[ article-parent ] subset
|
||||
[ "predicating" word-prop not ] subset ;
|
||||
|
||||
MAIN: check-help
|
||||
MAIN: help-lint
|
||||
|
|
Loading…
Reference in New Issue