class

Krikri::Lint::NameRule

Inherits Krikri::Lint::Rule < Reference < Object

Upstream parity: ansible-lint's name rule family (severity MEDIUM, tags idiom), implemented as three sub-rules matching upstream's message tags:

  • name[missing]: task has no name
  • name[casing]: name does not start with an uppercase letter
  • name[template]: Jinja expression not at the end of the name

Instance methods

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

Mirrors upstream's name[casing] transform: capitalize the first character of the name (prefix "file | " names keep their prefix) and update any handler notify references using the old name.

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?

Task-oriented: violations belong to an enclosing task, so a # noqa: anywhere in that task's body suppresses them.

Source
transformable?

Upstream's name transform only rewrites name[casing] matches and marks them fixed; the other sub-tags get the "not applied" ERROR.

Source