Skip to content

Commit

Permalink
Utilize yamllint severity levels for rule severity (#1530)
Browse files Browse the repository at this point in the history
yamllint allows to categorize found problems as "error" or "warning"
ansible-lint treats them all as having VERY_LOW severity anyway
This commit keeps the VERY_LOW severity categorization for problems
that yamllint reports as "warning", but uses MEDIUM severity for
problems reported as "error"
Syntax errors reported by yamllint are raised to VERY_HIGH severity

Co-authored-by: Sorin Sbarnea <ssbarnea@redhat.com>
  • Loading branch information
FloSchwalm and ssbarnea committed Apr 20, 2021
1 parent eab3e1b commit fd4b54a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ansiblelint/rules/YamllintRule.py
Expand Up @@ -83,6 +83,11 @@ def matchyaml(self, file: Lintable) -> List["MatchError"]:
for p in run_yamllint(
file.content, YamllintRule.config, filepath=file.path
):
self.severity = 'VERY_LOW'
if p.level == "error":
self.severity = 'MEDIUM'
if p.desc.endswith("(syntax)"):
self.severity = 'VERY_HIGH'
matches.append(
self.create_matcherror(
message=p.desc,
Expand Down

0 comments on commit fd4b54a

Please sign in to comment.