document-end¶
What this rule does¶
Requires or forbids the YAML document end marker (...).
Why this matters¶
- Streaming consumers. Producers that emit multiple YAML documents benefit from explicit end markers so consumers know each document is complete.
- Single-document files. Most single-document YAML files omit
...; forbidding it removes a trailing footer that adds no information.
Configuration¶
| Option | Default | Description |
|---|---|---|
present |
true |
When true, require a ... marker at the end of every document. When false, forbid it. |
Examples¶
Allowed (with present: true)¶
Reported (with present: true)¶
Allowed (with present: false)¶
After ryl check --fix (with present: true)¶
Automatic fixing¶
ryl check --fix adds a ... end marker to every document that lacks one
when present: true: before the --- that opens the next document, and at
the end of the stream. The present: false case (removing existing ...
markers) is never auto-fixed. A block scalar header or body at EOF gains the
newline and marker when the YAML 1.2 reference value is preserved. Spaces on a
final blank block-scalar line are removed only when they are indentation. A
root explicit-indent scalar with value-bearing final spaces keeps those spaces;
if its chomping indicator makes a marker unsafe, the final marker is left unfixed.
Disable with:
ryl format adds ... the same way only when [format] document-end is "add", and then conflicts with present = false; see Conflicting lint rules.
Related rules¶
document-start— the matching rule for the---start marker.new-line-at-end-of-file— controls the final newline character.