Closed adrienverge closed 1 year ago
I'll merge this now so it can go in the same release as https://github.com/adrienverge/yamllint/pull/548#issuecomment-1476606732.
Thanks for merging it. Apologies for the delay here. Have been busy lately and didn't get a chance to look into it further.
According to the YAML specification ^1:
The
forbid-undeclared-aliases
option checks that aliases do have a matching anchor declared previously in the document. Since this is required by the YAML spec, this option is enabled by default.This means that having a same anchor repeated in a document is allowed. However users could want to avoid this, so the new option
forbid-duplicated-anchors
allows that. It's disabled by default.This means that it's OK to declare anchors but don't have any alias referencing them. However users could want to avoid this, so a new option (e.g.
forbid-unused-anchors
) could be implemented in the future. See https://github.com/adrienverge/yamllint/pull/537.Fixes #395 Closes #420