From 977f4908b5f1944a0020b31defbb4b51935bfd42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Verg=C3=A9?= Date: Wed, 10 May 2023 06:45:08 +0200 Subject: [PATCH] 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) --- yamllint/rules/anchors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yamllint/rules/anchors.py b/yamllint/rules/anchors.py index befb8b4..83f29db 100644 --- a/yamllint/rules/anchors.py +++ b/yamllint/rules/anchors.py @@ -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