commas¶
What this rule does¶
Controls the number of spaces before and after commas (,) in flow
mappings and flow sequences.
Why this matters¶
- Readability.
[1, 2, 3]is easier to scan than[1,2 , 3]. - Consistent diffs. Normalising comma spacing prevents whitespace-only diffs.
Configuration¶
| Option | Default | Description |
|---|---|---|
max-spaces-before |
0 |
Maximum spaces before the comma. Use -1 to disable. |
min-spaces-after |
1 |
Minimum spaces after the comma. |
max-spaces-after |
1 |
Maximum spaces after the comma. Use -1 to disable. |
Examples¶
Allowed (defaults)¶
Reported (defaults)¶
After ryl --fix¶
Automatic fixing¶
ryl --fix normalises whitespace around commas to satisfy the configured
limits. Disable with: