The output from ansible-review shows some inconsistent formatting. For example, some internal WARN messages are shown without a rule number reference. I believe all WARN and ERROR messages should produce the same formatted output and contain:
- tag (WARN or ERROR)
- description
- unique rule number (for reference purposes)
- line number
- specific info (e.g... variable X is declared twice)
Most of the lint rules follow this concept. Here are some internal rules that do not.
From init.py. Two warnings are raised in this code but again they should follow the same output requirements as described above:
if not candidate.version:
candidate.version = standards_latest(standards.standards)
if candidate.expected_version:
if isinstance(candidate, ansiblereview.RoleFile):
warn("%s %s is in a role that contains a meta/main.yml without a declared "
"standards version. "
"Using latest standards version %s" %
(type(candidate).__name__, candidate.path, candidate.version),
settings)
else:
warn("%s %s does not present standards version. "
"Using latest standards version %s" %
(type(candidate).__name__, candidate.path, candidate.version),
settings)
They produce messages like this:
WARN: RoleVars vars/main.yml is in a role that contains a meta/main.yml without a declared standards version. Using latest standards version 0.1
WARN: Task tasks/main.yml is in a role that contains a meta/main.yml without a declared standards version. Using latest standards version 0.1
Also, another example is the following rule that checks YAML indentation. Here is the rule output:
WARN: Best practice "YAML should be correctly indented" not met:
vars/main.yml:4: indentation should increase by 2 chars
However, there is no rule number in the output.
Recommended changes:
- modify the internal
warn() and error() functions so that you can provide all of this info when these are raised internally.
- modify the lint rules to include the right info
The output from
ansible-reviewshows some inconsistent formatting. For example, some internalWARNmessages are shown without a rule number reference. I believe allWARNandERRORmessages should produce the same formatted output and contain:Most of the lint rules follow this concept. Here are some internal rules that do not.
From init.py. Two warnings are raised in this code but again they should follow the same output requirements as described above:
They produce messages like this:
Also, another example is the following rule that checks YAML indentation. Here is the rule output:
However, there is no rule number in the output.
Recommended changes:
warn()anderror()functions so that you can provide all of this info when these are raised internally.