Skip to content

Commit 44a5ccb

Browse files
committed
Add rule breakdown tables to markdown and smart reports
1 parent 0161b0a commit 44a5ccb

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ expect:
144144
145145
`diffscope eval` now reports per-rule precision/recall/F1 (micro and macro), and includes top rule-level TP/FP/FN counts in CLI and JSON output.
146146
Starter fixtures live in `eval/fixtures/repo_regressions`.
147+
Markdown and smart-review reports now include rule-level issue breakdown tables when rule ids are available.
147148

148149
### Smart Review (Enhanced Analysis)
149150
```bash

src/main.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2424,6 +2424,20 @@ fn format_as_markdown(comments: &[core::Comment]) -> String {
24242424
}
24252425
output.push('\n');
24262426

2427+
let rule_hits = summarize_rule_hits(comments, 12);
2428+
if !rule_hits.is_empty() {
2429+
output.push_str("### Issues by Rule\n\n");
2430+
output.push_str("| Rule | Count | Error | Warning | Info | Suggestion |\n");
2431+
output.push_str("|------|-------|-------|---------|------|------------|\n");
2432+
for (rule_id, hit) in rule_hits {
2433+
output.push_str(&format!(
2434+
"| `{}` | {} | {} | {} | {} | {} |\n",
2435+
rule_id, hit.total, hit.errors, hit.warnings, hit.infos, hit.suggestions
2436+
));
2437+
}
2438+
output.push('\n');
2439+
}
2440+
24272441
// Recommendations
24282442
if !summary.recommendations.is_empty() {
24292443
output.push_str("### Recommendations\n\n");
@@ -3091,6 +3105,20 @@ fn format_smart_review_output(
30913105
}
30923106
output.push('\n');
30933107

3108+
let rule_hits = summarize_rule_hits(comments, 12);
3109+
if !rule_hits.is_empty() {
3110+
output.push_str("#### By Rule\n\n");
3111+
output.push_str("| Rule | Count | Error | Warning | Info | Suggestion |\n");
3112+
output.push_str("|------|-------|-------|---------|------|------------|\n");
3113+
for (rule_id, hit) in rule_hits {
3114+
output.push_str(&format!(
3115+
"| `{}` | {} | {} | {} | {} | {} |\n",
3116+
rule_id, hit.total, hit.errors, hit.warnings, hit.infos, hit.suggestions
3117+
));
3118+
}
3119+
output.push('\n');
3120+
}
3121+
30943122
// Actionable Recommendations
30953123
if !summary.recommendations.is_empty() {
30963124
output.push_str("### 🎯 Priority Actions\n\n");

0 commit comments

Comments
 (0)