fix: report deprecated ansible-later features as warning by default (#233)

This commit is contained in:
Robert Kaussow 2021-10-10 17:00:44 +02:00 committed by GitHub
parent 6bbd302480
commit 123f8fbcb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 9 deletions

View File

@ -165,16 +165,18 @@ class Candidate(object):
extra=flag_extra(err_labels)
)
else:
LOG.error(
"{sid}Standard '{description}' not met:\n{path}:{error}".format(
sid=self._format_id(standard.sid),
description=standard.description,
path=self.path,
error=err
),
extra=flag_extra(err_labels)
msg = "{sid}Standard '{description}' not met:\n{path}:{error}".format(
sid=self._format_id(standard.sid),
description=standard.description,
path=self.path,
error=err
)
errors = errors + 1
if standard.sid not in self.config["rules"]["warning_filter"]:
LOG.error(msg, extra=flag_extra(err_labels))
errors = errors + 1
else:
LOG.warning(msg, extra=flag_extra(err_labels))
return errors

View File

@ -120,6 +120,7 @@ class Settings(object):
"standards": [],
"filter": [],
"exclude_filter": [],
"warning_filter": ["ANSIBLE9999"],
"ignore_dotfiles": True,
"exclude_files": [],
"version": ""

View File

@ -56,6 +56,12 @@ rules:
# Exclude given rule ID's from checks
exclude_filter: []
# List of rule ID's that should be displayed as a warning instead of an error. By default,
# only rules whose version is higher than the current default version are marked as warnings.
# This list allows to degrade errors to warnings for each rule.
warning_filter:
- "ANSIBLE9999"
# All dotfiles (including hidden folders) are excluded by default.
# You can disable this setting and handle dotfiles by yourself with `exclude_files`.
ignore_dotfiles: True

View File

@ -41,3 +41,4 @@ Reviews are nothing without some rules or standards against which to review. ans
| CheckLocalAction | ANSIBLE0024 | Don't use local_action. | |
| CheckRelativeRolePaths | ANSIBLE0025 | Don't use a relative path in a role. | |
| CheckChangedInWhen | ANSIBLE0026 | Use handlers instead of `when: changed`. | |
| CheckDeprecated | ANSIBLE9999 | Deprecated features of `ansible-later` should not be used. | |