24fb20d27e5a0904c4eb59d5e4836cea72260d69
[wolf] / docs / Reference.md
1 # Package WOLF
2
3 Enforces arbitrary set of style guidelines.
4
5 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.
6
7 ## Contents
8
9 * **function [check-directory](#function-check-directory)** - _check-directory_ grabs all .lisp files in the tree under _dir_, and loads checks them all.
10 * **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.
11 * **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.
12
13 ## Function **CHECK-DIRECTORY**
14
15 #### Syntax:
16
17 **check-directory** _dir_ => _results_
18
19 ```results::= result*```  
20
21 #### Arguments and Values:
22
23 _dir_---A directory to recurse into and check files  
24 _result_---A result as returned by check-file  
25
26 #### Description:
27
28 _check-directory_ grabs all .lisp files in the tree under _dir_, and loads checks them all.
29
30 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.
31
32 ## Function **CHECK-FILE**
33
34 #### Syntax:
35
36 **check-file** _file_ => _result_
37
38 ```result::= success-result | failure-result```  
39 ```success-result::= (:success filename)```  
40 ```failure-result::= (:success filename msg line-no col-no)```  
41
42 #### Arguments and Values:
43
44 _file_---a pathname  
45 _filename_---the file this check was run on  
46 _msg_---a string containing the failure message  
47 _line-no_---an integer, the line number on which the failure appeared  
48 _col-no_---an integer, the column number on which the failure appeared  
49
50 #### Description:
51
52 _check-file_ runs all the checks against a file and returns as soon as the first style error is found.
53
54 #### Examples:
55
56 ```(check-file #P"path/to/file.lisp")``` => ```(:success "path/to/file.lisp")```  
57 ```(check-file #P"path/to/error.lisp")``` => ```(:failure "path/to/error.lisp" "File cannot end with empty line" 20 0)```  
58
59 ## Function **PRETTY-PRINT-CHECK-DIRECTORY**
60
61 #### Syntax:
62
63 **pretty-print-check-directory** _dir_ => _success_
64
65 #### Arguments and Values:
66
67 _dir_---A directory to recurse into and check files  
68 _success_---T if there were no failures  
69
70 #### Description:
71
72 _pretty-print-check-directory_ checks _dir_ for any errors, dumping them to output and returning a single flag.
73
74 Unlike check-directory, _pretty-print-check-directory_ is built for continuous integration, dumping errors to standard out and returning a singular result.
75
76 #### Examples:
77
78 ```(pretty-print-check-directory "src")``` => ```nil```