Handles parsing and linting all of given files.
Handles parsing and linting all of given files.
(check-all-rules-of-type ctx rules form)
For each rule: if the rule is enabled, call check-rule
.
If check-rule
returns a non-nil result, add or append it to the accumulator.
Otherwise, return the accumulator.
For each rule: if the rule is enabled, call `check-rule`. If `check-rule` returns a non-nil result, add or append it to the accumulator. Otherwise, return the accumulator.
(check-and-recur ctx rules-by-type filename parent-form form)
Check a given form and then map recur over each of the form's children.
Check a given form and then map recur over each of the form's children.
(check-files! ctx rules-by-type files)
Call into the relevant check-path-X
function, depending on the given config.
Call into the relevant `check-path-X` function, depending on the given config.
(check-form ctx rules form)
Checks a given form against the appropriate rules then calls on-match
to build the
diagnostic and store it in ctx
.
Checks a given form against the appropriate rules then calls `on-match` to build the diagnostic and store it in `ctx`.
(check-pattern ctx rule pattern form)
Call :pattern
on the form and if it hits, call :on-match
on it.
Only attach parent-form
to the metadata after :pattern
is true, cuz
parent-form
can be potentially massive.
This has implications for pattern writing, where predicates can't rely on that metadata to exist.
Call `:pattern` on the form and if it hits, call `:on-match` on it. Only attach `parent-form` to the metadata after `:pattern` is true, cuz `parent-form` can be potentially massive. This has implications for pattern writing, where predicates can't rely on that metadata to exist.
(check-rule ctx rule form)
Rules either have :pattern
or :patterns
defined, never both.
To avoid iteration and seq manipulation costs, handle them separately.
Use reduced
to early exit when checking multiple patterns as we don't
want to create multiple diagnostics for a single form and rule.
Rules either have `:pattern` or `:patterns` defined, never both. To avoid iteration and seq manipulation costs, handle them separately. Use `reduced` to early exit when checking multiple patterns as we don't want to create multiple diagnostics for a single form and rule.
(parse-and-check-file ctx
rules-by-type
{:keys [ext file contents] :as file-obj})
Parse the given file and then check each form.
Parse the given file and then check each form.
(pre-filter-rules ctx rules-by-type)
Fully remove disabled rules or rules that don't apply to the current filetype.
Fully remove disabled rules or rules that don't apply to the current filetype.
(run args)
Convert command line args to usable options, pass to runner, print output.
Convert command line args to usable options, pass to runner, print output.
(run-impl paths config)
(run-impl paths config rules)
Actually perform check
Actually perform check
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close