Skip to content

Commit

Permalink
Drop E suffix when printing rule id
Browse files Browse the repository at this point in the history
From now on we no longer print E before rule id on parseable and
normal printing because it both reduced readability of the text
and also because it was misleading, some errors may be only
warnings but we always displayed only E.

This will also make it easier for us to migrate to text rule ids,
which are more human friendly.
  • Loading branch information
ssbarnea committed Feb 4, 2021
1 parent 958a253 commit ad22de1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ansiblelint/formatters/__init__.py
Expand Up @@ -83,7 +83,7 @@ class ParseableFormatter(BaseFormatter):
def format(self, match: "MatchError") -> str:
result = (
f"[filename]{self._format_path(match.filename or '')}[/]:{match.position}: "
f"[error_code]E{match.rule.id}[/] [dim]{self.escape(match.message)}[/]")
f"[error_code]{match.rule.id}[/] [dim]{self.escape(match.message)}[/]")
if match.tag:
result += f" [dim][error_code]({match.tag})[/][/]"
return result
Expand Down Expand Up @@ -137,7 +137,7 @@ def format(self, match: "MatchError") -> str:

filename = self._format_path(match.filename or "")
position = match.position
rule_id = u"E{0}".format(match.rule.id)
rule_id = u"{0}".format(match.rule.id)
severity = match.rule.severity
message = self.escape(str(match.message))

Expand Down
2 changes: 1 addition & 1 deletion test/TestUtils.py
Expand Up @@ -263,7 +263,7 @@ def test_cli_auto_detect(capfd):
assert "Discovering files to lint: git ls-files *.yaml *.yml" in err
# An expected rule match from our examples
assert "examples/playbooks/empty_playbook.yml:0: " \
"E911 Empty playbook, nothing to do" in out
"911 Empty playbook, nothing to do" in out
# assures that our .ansible-lint exclude was effective in excluding github files
assert "Identified: .github/" not in out
# assures that we can parse playbooks as playbooks
Expand Down

0 comments on commit ad22de1

Please sign in to comment.