module

Ignorelint::FormatLinter

The mixin interface for format-specific lint rules.

Every supported ignore format has a struct that include FormatLinter and implements two methods:

  • check_pattern: inspect a single pattern and return issues
  • check_patterns: inspect the full pattern list for cross-pattern issues

The mixin also provides a default build_glob implementation for filesystem dead-rule detection. Dockerignore overrides this because it strips slashes before matching.

Instance methods

build_glob(pat : Pattern, base_dir : String) : String

Build a filesystem glob for dead-rule detection, accounting for format-specific matching semantics (e.g., dockerignore strips slashes).

Rooted patterns get a direct path; unrooted patterns get a **/ prefix because in gitignore semantics they match at any depth.

check_pattern(pat : Pattern) : Array(Issue)

Check a single pattern for format-specific issues.

Returns an array of Issue values (empty if the pattern is clean for this format). Called once per active (non-blank, non-comment) pattern.

check_patterns(patterns : Array(Pattern), issues : Array(Issue)) : Nil

Check the full pattern list for cross-pattern issues.

Used for conflict detection (e.g. "build" followed by "!build"). Mutates the issues array in place for efficiency.