Skip to content

Commit 459a6ac

Browse files
fix(cli): include plugin rule in summary report (#7643)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 29e4229 commit 459a6ac

File tree

5 files changed

+91
-10
lines changed

5 files changed

+91
-10
lines changed

.changeset/warm-shrimps-wait.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
Fixed [#7580](https://github.com/biomejs/biome/issues/7580): Include plugin in summary report

crates/biome_cli/src/reporter/summary.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ impl ReporterVisitor for SummaryReporterVisitor<'_> {
122122
&& let Some(category) = category
123123
&& (category.name().starts_with("lint/")
124124
|| category.name().starts_with("suppressions/")
125-
|| category.name().starts_with("assist/"))
125+
|| category.name().starts_with("assist/")
126+
|| category.name().starts_with("plugin"))
126127
{
127128
files_to_diagnostics.insert_rule_for_file(category.name(), severity, location);
128129
}

crates/biome_cli/tests/cases/reporter_summary.rs

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
use crate::run_cli;
21
use crate::snap_test::{SnapshotPayload, assert_cli_snapshot};
2+
use crate::{run_cli, run_cli_with_server_workspace};
33
use biome_console::BufferConsole;
44
use biome_fs::MemoryFileSystem;
55
use bpaf::Args;
66
use camino::Utf8Path;
77

8+
const PLUGIN: &str = r#"
9+
`debugger` as $dbg where {
10+
register_diagnostic(
11+
message = "Found debugger statement",
12+
span = $dbg
13+
)
14+
}
15+
"#;
16+
817
const MAIN_1: &str = r#"import { z} from "z"
918
import { z, b , a} from "lodash"
1019
@@ -60,6 +69,17 @@ fn reports_diagnostics_summary_check_command() {
6069
let fs = MemoryFileSystem::default();
6170
let mut console = BufferConsole::default();
6271

72+
let plugin_path = Utf8Path::new("plugin.grit");
73+
fs.insert(plugin_path.into(), PLUGIN.as_bytes());
74+
75+
let file_path = Utf8Path::new("biome.json");
76+
fs.insert(
77+
file_path.into(),
78+
br#"{
79+
"plugins": ["plugin.grit"]
80+
}"#,
81+
);
82+
6383
let file_path1 = Utf8Path::new("main.ts");
6484
fs.insert(file_path1.into(), MAIN_1.as_bytes());
6585

@@ -69,7 +89,7 @@ fn reports_diagnostics_summary_check_command() {
6989
let file_path3 = Utf8Path::new("index.css");
7090
fs.insert(file_path3.into(), MAIN_3.as_bytes());
7191

72-
let (fs, result) = run_cli(
92+
let (fs, result) = run_cli_with_server_workspace(
7393
fs,
7494
&mut console,
7595
Args::from(
@@ -140,6 +160,17 @@ fn reports_diagnostics_summary_lint_command() {
140160
let fs = MemoryFileSystem::default();
141161
let mut console = BufferConsole::default();
142162

163+
let plugin_path = Utf8Path::new("plugin.grit");
164+
fs.insert(plugin_path.into(), PLUGIN.as_bytes());
165+
166+
let file_path = Utf8Path::new("biome.json");
167+
fs.insert(
168+
file_path.into(),
169+
br#"{
170+
"plugins": ["plugin.grit"]
171+
}"#,
172+
);
173+
143174
let file_path1 = Utf8Path::new("main.ts");
144175
fs.insert(file_path1.into(), MAIN_1.as_bytes());
145176

@@ -149,7 +180,7 @@ fn reports_diagnostics_summary_lint_command() {
149180
let file_path3 = Utf8Path::new("index.css");
150181
fs.insert(file_path3.into(), MAIN_3.as_bytes());
151182

152-
let (fs, result) = run_cli(
183+
let (fs, result) = run_cli_with_server_workspace(
153184
fs,
154185
&mut console,
155186
Args::from(

crates/biome_cli/tests/snapshots/main_cases_reporter_summary/reports_diagnostics_summary_check_command.snap

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
source: crates/biome_cli/tests/snap_test.rs
33
expression: redactor(content)
44
---
5+
## `biome.json`
6+
7+
```json
8+
{
9+
"plugins": ["plugin.grit"]
10+
}
11+
```
12+
513
## `index.css`
614

715
```css
@@ -64,6 +72,19 @@ let f;
6472
let f;
6573
```
6674
75+
## `plugin.grit`
76+
77+
```grit
78+
79+
`debugger` as $dbg where {
80+
register_diagnostic(
81+
message = "Found debugger statement",
82+
span = $dbg
83+
)
84+
}
85+
86+
```
87+
6788
# Termination Message
6889
6990
```block
@@ -99,8 +120,8 @@ reporter/violations ━━━━━━━━━━━━━━━━━━━━
99120
i The following files have violations:
100121
101122
- index.css (2 errors)
102-
- index.ts (21 errors, 8 warnings)
103-
- main.ts (21 errors, 8 warnings)
123+
- index.ts (25 errors, 8 warnings)
124+
- main.ts (25 errors, 8 warnings)
104125
105126
i The following lint rules have violations:
106127
@@ -112,11 +133,12 @@ reporter/violations ━━━━━━━━━━━━━━━━━━━━
112133
assist/source/organizeImports 2 (2 errors)
113134
lint/suspicious/noRedeclare 12 (12 errors)
114135
lint/suspicious/noDebugger 8 (8 errors)
136+
plugin 8 (8 errors)
115137
116138
```
117139
118140
```block
119141
Checked 3 files in <TIME>. No fixes applied.
120-
Found 49 errors.
142+
Found 57 errors.
121143
Found 16 warnings.
122144
```

crates/biome_cli/tests/snapshots/main_cases_reporter_summary/reports_diagnostics_summary_lint_command.snap

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
source: crates/biome_cli/tests/snap_test.rs
33
expression: redactor(content)
44
---
5+
## `biome.json`
6+
7+
```json
8+
{
9+
"plugins": ["plugin.grit"]
10+
}
11+
```
12+
513
## `index.css`
614

715
```css
@@ -64,6 +72,19 @@ let f;
6472
let f;
6573
```
6674
75+
## `plugin.grit`
76+
77+
```grit
78+
79+
`debugger` as $dbg where {
80+
register_diagnostic(
81+
message = "Found debugger statement",
82+
span = $dbg
83+
)
84+
}
85+
86+
```
87+
6788
# Termination Message
6889
6990
```block
@@ -91,8 +112,8 @@ reporter/violations ━━━━━━━━━━━━━━━━━━━━
91112
i The following files have violations:
92113
93114
- index.css (2 errors)
94-
- index.ts (20 errors, 8 warnings)
95-
- main.ts (20 errors, 8 warnings)
115+
- index.ts (24 errors, 8 warnings)
116+
- main.ts (24 errors, 8 warnings)
96117
97118
i The following lint rules have violations:
98119
@@ -103,11 +124,12 @@ reporter/violations ━━━━━━━━━━━━━━━━━━━━
103124
lint/suspicious/noDoubleEquals 8 (8 errors)
104125
lint/suspicious/noRedeclare 12 (12 errors)
105126
lint/suspicious/noDebugger 8 (8 errors)
127+
plugin 8 (8 errors)
106128
107129
```
108130
109131
```block
110132
Checked 3 files in <TIME>. No fixes applied.
111-
Found 43 errors.
133+
Found 51 errors.
112134
Found 16 warnings.
113135
```

0 commit comments

Comments
 (0)