module Hygiene: sig
.. end
Module for checking that the source tree is not polluted by object files.
type
rule =
Sanity rules to abide. Not to be confused with compilation rules.
type
pattern = suffix
Suffix matching is enough for the purpose of this module.
type
suffix = string
And a suffix is a string.
type
penalty =
A warning is simply displayed. A failures stops the compilation.
type
law = {
|
law_name : string ; |
|
law_rules : rule list ; |
|
law_penalty : penalty ; |
}
This type is used to encode laws that will be checked by this module.
val check : ?sanitize:string ->
law list -> bool Slurp.entry -> (law * string list) list
check ~sanitize laws entry
will scan the directory tree entry
for violation to the given laws
.
Any warnings or errors will be printed on the stdout
. If sanitize
is Some fn
, a shell script will be written
into the file fn
with commands to delete the offending files. The command will return a pair (fatal, penalties)
where fatal
is true
when serious hygiene violations have been spotted, and penalties
is a list of laws and
messages describing the offenses.