colons¶
What this rule does¶
Controls the number of spaces around mapping colons (:).
Why this matters¶
- Readability. Consistent spacing makes columnar layouts easier to scan, especially in configuration files with many short keys.
- Avoids ambiguity. Stray spaces around the colon can hide subtle parsing bugs, particularly when keys contain values that look like flow-style content.
Configuration¶
| Option | Default | Description |
|---|---|---|
max-spaces-before |
0 |
Maximum spaces between the key and the :. Use -1 to disable. |
max-spaces-after |
1 |
Maximum spaces between the : and the value. Use -1 to disable. |
Examples¶
Allowed (defaults)¶
Reported (defaults)¶
Allowed (with max-spaces-after: 2)¶
Automatic fixing¶
This rule does not auto-fix; correct spacing manually.