38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
|
|
|
||
|
|
import json
|
||
|
|
|
||
|
|
try:
|
||
|
|
with open('lint_report_v2.json', 'r') as f:
|
||
|
|
content = f.read()
|
||
|
|
json_start = content.find('[')
|
||
|
|
if json_start != -1:
|
||
|
|
report = json.loads(content[json_start:])
|
||
|
|
else:
|
||
|
|
print("Could not find JSON start")
|
||
|
|
exit(1)
|
||
|
|
|
||
|
|
errors = []
|
||
|
|
for file_result in report:
|
||
|
|
for msg in file_result.get('messages', []):
|
||
|
|
if msg.get('severity') == 2:
|
||
|
|
errors.append(f"{file_result['filePath']}:{msg['line']} - {msg['ruleId']} - {msg['message']}")
|
||
|
|
|
||
|
|
print(f"Found {len(errors)} errors:")
|
||
|
|
for err in errors[:50]: # Print first 50 errors
|
||
|
|
print(err)
|
||
|
|
|
||
|
|
# Group by ruleId
|
||
|
|
rule_counts = {}
|
||
|
|
for file_result in report:
|
||
|
|
for msg in file_result.get('messages', []):
|
||
|
|
if msg.get('severity') == 2:
|
||
|
|
rule_id = msg.get('ruleId', 'unknown')
|
||
|
|
rule_counts[rule_id] = rule_counts.get(rule_id, 0) + 1
|
||
|
|
|
||
|
|
print("\nError counts by rule:")
|
||
|
|
for rule, count in rule_counts.items():
|
||
|
|
print(f"{rule}: {count}")
|
||
|
|
|
||
|
|
except Exception as e:
|
||
|
|
print(f"Error parsing report: {e}")
|