ryl Rules Reference¶
A comprehensive reference of all YAML linting rules¶
Introduction¶
ryl implements 23 rules for checking YAML files. This page is a categorised index of every rule with a brief description and a link to its detailed documentation. Each rule page covers what the rule does, why it matters, configuration options, and (where applicable) automatic fix behaviour.
For configuration discovery, presets, and file selection, see Configuration presets. For migrating from yamllint, see Migrating from yamllint.
Rule categories¶
- Layout and spacing — whitespace, indentation, line endings, line length
- Document structure — document markers, empty values, anchors, keys
- Comments — comment placement and spacing
- Values — numeric, string, and boolean value formats
Rules that auto-fix are marked with in the Fix column.
Layout and spacing¶
| Rule | Description | Fix |
|---|---|---|
braces |
Spaces inside flow mapping braces ({...}). |
|
brackets |
Spaces inside flow sequence brackets ([...]). |
|
colons |
Spaces around mapping colons. | |
commas |
Spaces around flow collection commas. | |
empty-lines |
Number of consecutive empty lines. | |
hyphens |
Spaces after sequence hyphens. | |
indentation |
Block indentation, sequence indentation, multi-line strings. | |
line-length |
Maximum line length. | |
new-line-at-end-of-file |
A single trailing newline at end of file. | |
new-lines |
Consistent line endings (LF vs CRLF). | |
trailing-spaces |
Trailing whitespace at end of lines. |
Document structure¶
| Rule | Description | Fix |
|---|---|---|
anchors |
Anchor and alias declarations and usage. | |
document-end |
Document end marker .... |
|
document-start |
Document start marker ---. |
|
empty-values |
Empty values in mappings and sequences. | |
key-duplicates |
Duplicate keys in mappings. | |
key-ordering |
Alphabetical ordering of mapping keys. |
Comments¶
| Rule | Description | Fix |
|---|---|---|
comments |
Spaces after # and before inline comments. |
|
comments-indentation |
Comment alignment with surrounding content. |
Values¶
| Rule | Description | Fix |
|---|---|---|
float-values |
Float value formats. | |
octal-values |
Octal value formats. | |
quoted-strings |
Quoted string styles and when to require quotes. | |
truthy |
Truthy values like yes, no, on, off. |
Severity levels¶
Every rule can be configured to report at either error (the default for
most rules) or warning. Errors cause ryl to exit non-zero; warnings are
printed but do not fail the run.
Configure the severity inline with the rule:
Enabling and disabling rules¶
Toggle a rule on or off with a top-level string in the [rules] table:
Enabling a rule without options applies its defaults. The three built-in
presets — default, relaxed, and empty — cover the common
starting points; see Configuration presets.
Automatic fixing¶
The --fix flag applies safe fixes for rules marked with above:
Control which rules apply fixes with a [fix] table: