Skip to content

Commit

Permalink
feat(linter): include explanation in ruff lint messages (#78)
Browse files Browse the repository at this point in the history
Include explanation in ruff lint messages when --explain is true
  • Loading branch information
justinchuby authored Oct 16, 2023
1 parent 6aba46c commit 0609956
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lintrunner_adapters/adapters/ruff_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ def explain_rule(code: str) -> str:
check=True,
)
rule = json.loads(str(proc.stdout, "utf-8").strip())
return f"\n{rule['linter']}: {rule['summary']}"
text = f"\n{rule['linter']}: {rule['summary']}"
if "explanation" in rule:
text += f"\n\n{rule['explanation']}"
return text


def get_issue_severity(code: str) -> LintSeverity:
Expand Down

0 comments on commit 0609956

Please sign in to comment.