no-duplicate-anchors
What it does
Section titled “What it does”Reports an anchor name that is defined again in the same document, on the second &name.
Why it matters
Section titled “Why it matters”An alias refers to the latest definition above it, so after a repeated anchor the same *name can mean two different nodes depending on its place, which is easy to misread.
To fix, give the second anchor another name.
Example
Section titled “Example”- &a 1- &a 2Configuration
Section titled “Configuration”github-actions: lint: rules: no-duplicate-anchors: warn # off, warn (default), erroryaml: lint: rules: no-duplicate-anchors: warn # off, warn (default), errorEnabled by the presets: yaml/yamllint.
Suppress one line with sudsy-disable-next-line no-duplicate-anchors in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| yamllint | anchors.forbid-duplicated-anchors |
full |