Skip to content

no-unused-anchors

Reports an anchor that no alias refers to. The fix removes the anchor and changes nothing about the data.

An anchor that nobody uses is left from a removed alias and makes a reader look for the place that shares the node.

Reported
a: &x 1
b: &y 2
c: *y
After the fix
a: 1
b: &y 2
c: *y
github-actions:
lint:
rules:
no-unused-anchors: warn # off (default), warn, error
yaml:
lint:
rules:
no-unused-anchors: warn # off (default), warn, error

Enabled by the presets: github-actions/actionlint.

Suppress one line with sudsy-disable-next-line no-unused-anchors in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
actionlint syntax-check/unused-anchor partial The shared YAML rule, enabled by the preset for workflows.
yamllint anchors.forbid-unused-anchors full