ruff linter implemented
This commit is contained in:
@@ -75,13 +75,18 @@ class PythonRuff:
|
||||
if not compressed:
|
||||
return f"Ruff Violations\nTARGET: {target_dir}\nNo violations found."
|
||||
|
||||
# First pass: Collect all unique rule definitions from compressed violations
|
||||
# First pass: Collect rule definitions and calculate summary metrics
|
||||
rule_definitions: dict[str, str] = {}
|
||||
total_violations = 0
|
||||
|
||||
for file_violations in compressed.values():
|
||||
total_violations += len(file_violations)
|
||||
for v in file_violations:
|
||||
if v["code"] not in rule_definitions:
|
||||
rule_definitions[v["code"]] = v["message"]
|
||||
|
||||
file_count = len(compressed)
|
||||
|
||||
# Build output buffer
|
||||
lines = [
|
||||
"Ruff Violations",
|
||||
@@ -94,11 +99,17 @@ class PythonRuff:
|
||||
lines.append(f" - {code}: {rule_definitions[code]}")
|
||||
|
||||
lines.append("")
|
||||
|
||||
for rel_file, file_violations in compressed.items():
|
||||
lines.append(f"- FILE: {rel_file}")
|
||||
for v in file_violations:
|
||||
lines.append(f" - {v['line']}:{v['column']} {v['code']}")
|
||||
|
||||
lines.append("")
|
||||
lines.append("- SUMMARY:")
|
||||
lines.append(f" - Total files with violations: {file_count}")
|
||||
lines.append(f" - Total violations: {total_violations}")
|
||||
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user