class

Krikri::Lint::YamlEmptyLinesRule

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

Upstream parity: yaml[empty-lines] (from yamllint defaults, as configured by ansible-lint's bundled .yamllint: max 2, max-start 0, max-end 0; error level, MEDIUM here). Only the last blank line of a run is reported, at that line with no column: "Too many blank lines (N > M)".

Constants

MAX = 2
MAX_END = 0
MAX_START = 0

Instance methods

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

The violation points at the last blank line of an over-long run; the run extends upward. Keep the first max blank lines of the run and delete the excess.

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
severity
Source
tags
Source
transformable?

Upstream's yaml transform is a documented no-op (the reformatting happens in the data dumper), so it never marks a match fixed; every yaml[*] match gets a "not applied" ERROR.

Source