ryl Rules Reference¶
A comprehensive reference of all YAML linting rules¶
Introduction¶
ryl implements 27 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, tags, 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 |
|---|---|---|
block-scalar-chomping |
Explicit chomping indicator (-/+) on block scalars. |
|
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. | |
unicode-line-breaks |
Raw NEL / LS / PS characters (not YAML 1.2 line breaks). |
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. | |
merge-keys |
The << merge key (a YAML 1.1 feature removed in 1.2). |
|
tags |
Unsafe and non-portable YAML tags. |
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 built-in default
and relaxed presets cover the common starting points (the empty preset is
YAML-extends: only, with no usable TOML form); see
Configuration presets.
To switch rules off for part of a file with # ryl disable /
# yamllint disable comments, see Inline directives.
Automatic fixing¶
The --fix flag applies safe fixes for rules marked with above:
Control which rules apply fixes with a [fix] table: