From 8dab577bf6984a8a2d751faf6be99ee783d2a987 Mon Sep 17 00:00:00 2001 From: Roald Nefs Date: Mon, 21 Oct 2019 20:12:33 +0200 Subject: [PATCH] Fix 210 to skip non-number values Fix rule 210 to skip non-number values (e.g. `000-default`) as they aren't octal values but strings. This commit also allows optional whitespace around the unquoted octal value, and the value followed by a YAML or JINJA comment (e.g. `0700 {# JINJA COMMENT #}`). Fixes #68. Signed-off-by: Roald Nefs --- saltlint/rules/YamlHasOctalValueRule.py | 2 +- tests/unit/TestYamlHasOctalValueRule.py | 34 +++++++++++++++++-------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/saltlint/rules/YamlHasOctalValueRule.py b/saltlint/rules/YamlHasOctalValueRule.py index b499b2d..7100a68 100644 --- a/saltlint/rules/YamlHasOctalValueRule.py +++ b/saltlint/rules/YamlHasOctalValueRule.py @@ -15,7 +15,7 @@ class YamlHasOctalValueRule(SaltLintRule): tags = ['formatting'] version_added = 'v0.0.6' - bracket_regex = re.compile(r": (?