Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop E suffix when printing rule id #1305

Merged
merged 1 commit into from Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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