Skip to content

Commit

Permalink
anchors: Add missing quotes in unused anchor error message
Browse files Browse the repository at this point in the history
Existing `anchors` options use quotes around the anchor name:

    2:3       error    found undeclared alias "unknown"  (anchors)
    4:3       error    found duplicated anchor "dup"  (anchors)

Let's do the same in the newly-added option `forbid-unused-anchors`:

    5:3       error    found unused anchor "not used"  (anchors)
  • Loading branch information
adrienverge committed May 10, 2023
1 parent f874b66 commit 977f490
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion yamllint/rules/anchors.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def check(conf, token, prev, next, nextnext, context):
if not info['used']:
yield LintProblem(info['line'] + 1,
info['column'] + 1,
f"found unused anchor {anchor}")
f'found unused anchor "{anchor}"')
elif isinstance(token, yaml.AliasToken):
context['anchors'].get(token.value, {})['used'] = True

Expand Down

0 comments on commit 977f490

Please sign in to comment.