Skip to main content

Module markdown_exclude

Module markdown_exclude 

Source
Expand description

The gitignore-syntax exclude patterns of markdown/autofix, matched as the linter matches them. What: The exclude option of markdown/autofix: gitignore-syntax patterns, relative to the repository’s top level, naming candidates the policy leaves alone. Why: The installed wrapper filtered candidates with the ignore package before starting the linter (rewrite-candidates.ts, rewriteCandidates), so an excluded file never starts a linter and never fails for one. The linter evaluates its own copy of the option with the ignore crate’s gitignore matcher and a walk over ancestor directories (package/linter/monochromatic-lint/src/markdown_lfs_patterns.rs); this module uses the same matcher and the same walk, so both agree on every path.

In TS you’d write (pseudocode):

// const excluded = ignore().add(exclude); if (excluded.ignores(candidate.path)) continue;

Structs§

ExcludeMatcher
What: The compiled patterns. The field is private: build one with compile_exclude. Why: Compiled once per invocation, then asked once per Markdown candidate.

Functions§

compile_exclude
What: Compile patterns in order. Result<ExcludeMatcher, String> is the matcher or the reason a pattern was refused, naming it. Why: A pattern that cannot compile must not silently match nothing. The empty root keeps candidate paths as Git prints them: relative to the top level.