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 ;
|
USING: help.markup help.syntax ;
|
||||||
IN: help.lint
|
IN: help.lint
|
||||||
|
|
||||||
HELP: check-help
|
HELP: help-lint-all
|
||||||
{ $description "Checks all word and article help." } ;
|
{ $description "Checks all word help and articles in all loaded vocabularies." } ;
|
||||||
|
|
||||||
HELP: check-vocab-help
|
HELP: help-lint
|
||||||
{ $values { "vocab" "a vocabulary specifier" } }
|
{ $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"
|
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."
|
"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
|
$nl
|
||||||
"To run help lint, use one of the following two words:"
|
"To run help lint, use one of the following two words:"
|
||||||
{ $subsection check-help }
|
{ $subsection help-lint }
|
||||||
{ $subsection check-vocab-help }
|
{ $subsection help-lint-all }
|
||||||
"Help lint performs the following checks:"
|
"Help lint performs the following checks:"
|
||||||
{ $list
|
{ $list
|
||||||
"ensures examples run and produce stated output"
|
"ensures examples run and produce stated output"
|
||||||
{ "ensures " { $link $see-also } " elements don't contain duplicate entries" }
|
{ "ensures " { $link $see-also } " elements don't contain duplicate entries" }
|
||||||
{ "ensures " { $link $vocab-link } " elements point to modules which actually exist" }
|
{ "ensures " { $link $vocab-link } " elements point to modules which actually exist" }
|
||||||
{ "ensures that " { $link $values } " match the stack effect declaration" }
|
{ "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"
|
ABOUT: "help.lint"
|
||||||
|
|
|
@ -5,7 +5,7 @@ words strings classes tools.browser namespaces io
|
||||||
io.streams.string prettyprint definitions arrays vectors
|
io.streams.string prettyprint definitions arrays vectors
|
||||||
combinators splitting debugger hashtables sorting effects vocabs
|
combinators splitting debugger hashtables sorting effects vocabs
|
||||||
vocabs.loader assocs editors continuations classes.predicate
|
vocabs.loader assocs editors continuations classes.predicate
|
||||||
macros combinators.lib ;
|
macros combinators.lib sequences.lib ;
|
||||||
IN: help.lint
|
IN: help.lint
|
||||||
|
|
||||||
: check-example ( element -- )
|
: check-example ( element -- )
|
||||||
|
@ -84,7 +84,7 @@ M: help-error error.
|
||||||
delegate error. ;
|
delegate error. ;
|
||||||
|
|
||||||
: check-something ( obj quot -- )
|
: check-something ( obj quot -- )
|
||||||
over . flush [ <help-error> , ] recover ; inline
|
flush [ <help-error> , ] recover ; inline
|
||||||
|
|
||||||
: check-word ( word -- )
|
: check-word ( word -- )
|
||||||
dup word-help [
|
dup word-help [
|
||||||
|
@ -106,22 +106,45 @@ M: help-error error.
|
||||||
[ dup check-rendering ] assert-depth drop
|
[ dup check-rendering ] assert-depth drop
|
||||||
] check-something ;
|
] check-something ;
|
||||||
|
|
||||||
: check-articles ( -- )
|
: group-articles ( -- assoc )
|
||||||
articles get keys [ check-article ] each ;
|
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
|
all-vocabs-seq [ vocab-name ] map "all-vocabs" set
|
||||||
call
|
articles get keys "group-articles" set
|
||||||
] { } make [ nl error. ] each ; inline
|
child-vocabs
|
||||||
|
[ dup check-vocab ] { } map>assoc
|
||||||
|
[ nip empty? not ] assoc-subset
|
||||||
|
] with-scope ;
|
||||||
|
|
||||||
: check-help ( -- )
|
: typos. ( assoc -- )
|
||||||
[ all-words check-words check-articles ] with-help-lint ;
|
dup empty? [
|
||||||
|
drop
|
||||||
: check-vocab-help ( vocab -- )
|
"==== ALL CHECKS PASSED" print
|
||||||
|
] [
|
||||||
[
|
[
|
||||||
child-vocabs [ words check-words ] each
|
swap vocab-heading.
|
||||||
] with-help-lint ;
|
[ error. nl ] each
|
||||||
|
] assoc-each
|
||||||
|
] if ;
|
||||||
|
|
||||||
|
: help-lint ( prefix -- ) run-help-lint typos. ;
|
||||||
|
|
||||||
|
: help-lint-all ( -- ) "" help-lint ;
|
||||||
|
|
||||||
: unlinked-words ( words -- seq )
|
: unlinked-words ( words -- seq )
|
||||||
all-word-help [ article-parent not ] subset ;
|
all-word-help [ article-parent not ] subset ;
|
||||||
|
@ -132,4 +155,4 @@ M: help-error error.
|
||||||
[ article-parent ] subset
|
[ article-parent ] subset
|
||||||
[ "predicating" word-prop not ] subset ;
|
[ "predicating" word-prop not ] subset ;
|
||||||
|
|
||||||
MAIN: check-help
|
MAIN: help-lint
|
||||||
|
|
Loading…
Reference in New Issue