anchors: Add missing quotes in unused anchor error message

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)
pull/572/head
Adrien Vergé 2 years ago
parent f874b6607c
commit 977f4908b5

@ -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

Loading…
Cancel
Save