class

Krikri::Lint::Rule

Inherits Reference < Object

Instance methods

applies?(file : PositionedFile) : Bool
Source
applies_to
Source
check(file : PositionedFile, violations : Array(Violation))
Source
fix(buffer : FixBuffer, file : PositionedFile, violation : Violation) : Bool
Source
fixable?

Autofix support, mirroring upstream's TransformMixin: a rule opts in by overriding fixable? (and carrying the "autofix" tag like upstream does) and implementing fix. fix must only make line-local edits through the FixBuffer (replace spans within existing lines, delete whole lines, add the final newline); returning true marks the violation fixed so the CLI drops it from the report.

Source
marks_fixed?(violation : Violation) : Bool

Whether upstream's transform marks the given violation fixed. Transformable rules that do not mark it fixed get an "Rule specific fix not applied for" ERROR logged for the match.

Source
severity
Source
tags
Source
task_scoped?

Whether this rule's violations belong to an enclosing task, and so are suppressed by a # noqa: appearing anywhere inside that task's body. Upstream separates these: matchtask results are filtered by the task's own skip list, while matchyaml results (the yaml[*] family, load-failure) only honour a comment on the violation's own line. Rules that walk tasks (TaskWalker) are task-scoped; file-level rules are not.

Source
transformable?

Upstream's TransformMixin: the --fix transformer attempts a rule-specific transform for matches of these rules, even when krikri has no line fix of its own (upstream's yaml transform is a documented no-op, yet every yaml[*] match gets a "Rule specific fix not applied for" ERROR from it).

Source