Enforces arbitrary set of style guidelines.
This package walks over common lisp code to make sure it adheres to a set of syntactic guidelines designed to ensure a semblance of uniformity. No current one was found that could be configured to work the way this one does, so instead of writing a configurable tool, another unconfigurable one was born.
check-directory dir &key copyright-notice => results
results::= result*
dir---A directory to recurse into and check files copyright-notice---A regex string result---A result as returned by check-file
check-directory grabs all .lisp files in the tree under dir, and loads checks them all.
If copyright-notice is included, then the first line must match the regular expression passed.
The results are then put together into a list which can be programatically evaluated. As opposed to pretty-print-check-directory, this function doesn't clutter up your standard out.
check-file file &key copyright-notice => result
result::= success-result | failure-result
success-result::= (:success filename)
failure-result::= (:success filename msg line-no col-no)
file---a pathname copyright-notice---A regex string filename---the file this check was run on msg---a string containing the failure message line-no---an integer, the line number on which the failure appeared col-no---an integer, the column number on which the failure appeared
check-file runs all the checks against a file and returns as soon as the first style error is found.
If copyright-notice is included, then the first line must match the regular expression passed.
(check-file #P"path/to/file.lisp")
=> (:success "path/to/file.lisp")
(check-file #P"path/to/error.lisp")
=> (:failure "path/to/error.lisp" "File cannot end with empty line" 20 0)
(check-file #P"path/to/error.lisp" :copyright-notice "; Copyright .* AGPL")
=> (:failure ...)
pretty-print-check-directory dir &key copyright-notice => success
dir---A directory to recurse into and check files copyright-notice---A regex string success---T if there were no failures
pretty-print-check-directory checks dir for any errors, dumping them to output and returning a single flag.
If copyright-notice is included, then the first line must match the regular expression passed.
Unlike check-directory, pretty-print-check-directory is built for continuous integration, dumping errors to standard out and returning a singular result.
(pretty-print-check-directory "src")
=> nil