X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?p=wolf;a=blobdiff_plain;f=docs%2FReference.md;fp=docs%2FReference.md;h=24fb20d27e5a0904c4eb59d5e4836cea72260d69;hp=0000000000000000000000000000000000000000;hb=6ea66bbdff1cc0356c121d453857ecb9d3c1e351;hpb=981fd3d9a7ad7e2b2dc4e92c5b594e6b2684a888 diff --git a/docs/Reference.md b/docs/Reference.md new file mode 100644 index 0000000..24fb20d --- /dev/null +++ b/docs/Reference.md @@ -0,0 +1,78 @@ +# Package WOLF + +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. + +## Contents + +* **function [check-directory](#function-check-directory)** - _check-directory_ grabs all .lisp files in the tree under _dir_, and loads checks them all. +* **function [check-file](#function-check-file)** - _check-file_ runs all the checks against a file and returns as soon as the first style error is found. +* **function [pretty-print-check-directory](#function-pretty-print-check-directory)** - _pretty-print-check-directory_ checks _dir_ for any errors, dumping them to output and returning a single flag. + +## Function **CHECK-DIRECTORY** + +#### Syntax: + +**check-directory** _dir_ => _results_ + +```results::= result*``` + +#### Arguments and Values: + +_dir_---A directory to recurse into and check files +_result_---A result as returned by check-file + +#### Description: + +_check-directory_ grabs all .lisp files in the tree under _dir_, and loads checks them all. + +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. + +## Function **CHECK-FILE** + +#### Syntax: + +**check-file** _file_ => _result_ + +```result::= success-result | failure-result``` +```success-result::= (:success filename)``` +```failure-result::= (:success filename msg line-no col-no)``` + +#### Arguments and Values: + +_file_---a pathname +_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 + +#### Description: + +_check-file_ runs all the checks against a file and returns as soon as the first style error is found. + +#### Examples: + +```(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)``` + +## Function **PRETTY-PRINT-CHECK-DIRECTORY** + +#### Syntax: + +**pretty-print-check-directory** _dir_ => _success_ + +#### Arguments and Values: + +_dir_---A directory to recurse into and check files +_success_---T if there were no failures + +#### Description: + +_pretty-print-check-directory_ checks _dir_ for any errors, dumping them to output and returning a single flag. + +Unlike check-directory, _pretty-print-check-directory_ is built for continuous integration, dumping errors to standard out and returning a singular result. + +#### Examples: + +```(pretty-print-check-directory "src")``` => ```nil```