Use this rule to control the number of spaces after hyphens (-).
max-spaces-after.check-scalars to true.
Use with caution as all scalars will be checked and non-solvable false
positive might be identified. Has no effect when set to true but
min-spaces-after is disabled (< 0).Examples
With max-spaces-after = 1
the following code snippet would PASS:
- first list:
- a
- b
- - 1
- 2
- 3
the following code snippets would FAIL:
- first list:
- a
- b
With max-spaces-after = 3
the following code snippet would PASS:
- key
- key2
- key42
the following code snippet would FAIL:
- key
- key2
- key42
With hyphens: {min-spaces-after: 3}
the following code snippet would PASS:
list:
- key
- key2
- key42
-foo: # starter of a new sequence named "-foo"; without the colon, a syntax error will be raised.
the following code snippet would FAIL:
- key
- key2
- key42
With hyphens: {min-spaces-after: 3, check-scalars: true}
the following code snippet would PASS:
list:
- key
- key2
- key42
key: -value
the following code snippet would FAIL:
---
-item
or
sequence:
-key # Mind the spaces before the hyphen to enforce the sequence and avoid a syntax error