Skip to content

feat(cli): concise reporter#9539

Merged
ematipico merged 2 commits intonextfrom
feat/reporter-concise
Mar 23, 2026
Merged

feat(cli): concise reporter#9539
ematipico merged 2 commits intonextfrom
feat/reporter-concise

Conversation

@ematipico
Copy link
Copy Markdown
Member

@ematipico ematipico commented Mar 18, 2026

Summary

Closes #6970

This reporter is a bit different from the others because it affects how diagnostics are printed on console, which means we use the default reporter to terminal, but we print the diagnostics differently.

The PrintDiagnostic::concise function was implemented with AI, and I fixed a little bit. I also used it to create tests. I implemented the rest.

Test Plan

Added new tests

Docs

I'll need to create one

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 18, 2026

🦋 Changeset detected

Latest commit: 6898165

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@biomejs/biome Minor
@biomejs/cli-win32-x64 Minor
@biomejs/cli-win32-arm64 Minor
@biomejs/cli-darwin-x64 Minor
@biomejs/cli-darwin-arm64 Minor
@biomejs/cli-linux-x64 Minor
@biomejs/cli-linux-arm64 Minor
@biomejs/cli-linux-x64-musl Minor
@biomejs/cli-linux-arm64-musl Minor
@biomejs/wasm-web Minor
@biomejs/wasm-bundler Minor
@biomejs/wasm-nodejs Minor
@biomejs/backend-jsonrpc Patch
@biomejs/js-api Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added A-CLI Area: CLI A-Diagnostic Area: diagnostocis labels Mar 18, 2026
@ematipico ematipico requested review from a team March 18, 2026 11:38
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 18, 2026

Walkthrough

Adds a new --reporter=concise CLI option and implements a concise single-line diagnostics reporter. Changes include: new CliReporterKind::Concise variant with FromStr/Display support; ConsoleReporterVisitor now carries a concise: bool flag and finalizer wiring propagates it; diagnostics display gains a concise rendering path with helpers for file location and category; tests added for concise output across check, ci, lint, and format. A changeset documents a minor release for @biomejs/biome.

Possibly related PRs

Suggested reviewers

  • Netail
  • dyc3
🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive While the PR implements a concise reporter with one-line diagnostics and file reformatting aggregation, the snapshot tests lack explicit verification that all requirements are fully met. Ensure snapshot tests verify: one-line diagnostic format with severity icon/path/code/summary, reformatted files section, and stdout summary with file counts and duration.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(cli): concise reporter' accurately and concisely describes the main change—implementing a new concise reporter feature for the CLI.
Out of Scope Changes check ✅ Passed All changes are scoped to implementing the concise reporter feature: CLI options, terminal reporter logic, diagnostic display formatting, and corresponding tests.
Description check ✅ Passed The PR description clearly relates to the changeset, referencing issue #6970 and explaining the concise reporter implementation with context about PrintDiagnostic and testing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/reporter-concise
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
crates/biome_cli/tests/cases/reporter_concise.rs (1)

29-170: Optional tidy-up: factor shared test scaffolding into a helper.

The setup/run/assert pattern is repeated four times; a tiny helper would trim noise and make future reporter cases easier to add.

♻️ Possible refactor sketch
+fn run_concise(command: &str, snapshot_name: &str) {
+    let fs = MemoryFileSystem::default();
+    let mut console = BufferConsole::default();
+
+    let file_path1 = Utf8Path::new("main.ts");
+    fs.insert(file_path1.into(), MAIN_1.as_bytes());
+    let file_path2 = Utf8Path::new("index.ts");
+    fs.insert(file_path2.into(), MAIN_2.as_bytes());
+
+    let (fs, result) = run_cli(
+        fs,
+        &mut console,
+        Args::from([command, "--reporter=concise", file_path1.as_str(), file_path2.as_str()].as_slice()),
+    );
+
+    assert!(result.is_err(), "run_cli returned {result:?}");
+    assert_cli_snapshot(SnapshotPayload::new(module_path!(), snapshot_name, fs, console, result));
+}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_cli/tests/cases/reporter_concise.rs` around lines 29 - 170,
Extract the repeated test scaffolding in
reports_diagnostics_concise_check_command,
reports_diagnostics_concise_ci_command,
reports_diagnostics_concise_lint_command, and
reports_diagnostics_concise_format_command into a small helper (e.g., a function
like run_concise_report_test) that takes the command name
("check"/"ci"/"lint"/"format") and snapshot name, creates MemoryFileSystem and
BufferConsole, inserts MAIN_1/MAIN_2, calls run_cli with Args::from([...
"--reporter=concise", file_path1, file_path2]), asserts result is Err, and calls
assert_cli_snapshot(SnapshotPayload::new(...)); then replace each test body with
a single call to that helper to reduce duplication while keeping run_cli,
Args::from, and assert_cli_snapshot usage intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/biome_diagnostics/src/display.rs`:
- Around line 195-197: The code adds a header space based on has_file (let
has_file = diagnostic.location().resource.is_some()) but print_file_location
only prints when the resource is Resource::File, causing a stray space for
non-file resources; change the condition used before writing the leading space
to explicitly check for a file resource (e.g., match or matches! on
diagnostic.location().resource being Resource::File) so the space is only
written when print_file_location will actually print; update the logic around
has_file/print_file_location accordingly.
- Around line 282-287: The fixed code should stop unconditionally writing ": "
separators in concise mode; instead, only emit the colon+space when the adjacent
piece actually printed something. Update the display logic around the
fmt.write_str calls and print_category(diagnostic) so you check whether a
location or category exists (e.g., use diagnostic.location.is_some() and
diagnostic.category.is_some()) or change print_category to return a bool
indicating it printed, and conditionally call fmt.write_str(": ") based on that
boolean (or the presence checks) to avoid printing "✖ : ..." when either side is
empty.

---

Nitpick comments:
In `@crates/biome_cli/tests/cases/reporter_concise.rs`:
- Around line 29-170: Extract the repeated test scaffolding in
reports_diagnostics_concise_check_command,
reports_diagnostics_concise_ci_command,
reports_diagnostics_concise_lint_command, and
reports_diagnostics_concise_format_command into a small helper (e.g., a function
like run_concise_report_test) that takes the command name
("check"/"ci"/"lint"/"format") and snapshot name, creates MemoryFileSystem and
BufferConsole, inserts MAIN_1/MAIN_2, calls run_cli with Args::from([...
"--reporter=concise", file_path1, file_path2]), asserts result is Err, and calls
assert_cli_snapshot(SnapshotPayload::new(...)); then replace each test body with
a single call to that helper to reduce duplication while keeping run_cli,
Args::from, and assert_cli_snapshot usage intact.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c79f09da-0962-4587-bb67-ed72d39134f5

📥 Commits

Reviewing files that changed from the base of the PR and between 4d251d4 and a610336.

⛔ Files ignored due to path filters (10)
  • crates/biome_cli/tests/snapshots/main_cases_help/check_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_help/ci_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_help/format_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_help/lint_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_help/migrate_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_help/rage_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_reporter_concise/reports_diagnostics_concise_check_command.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_reporter_concise/reports_diagnostics_concise_ci_command.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_reporter_concise/reports_diagnostics_concise_format_command.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_reporter_concise/reports_diagnostics_concise_lint_command.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (7)
  • .changeset/add-concise-reporter.md
  • crates/biome_cli/src/cli_options.rs
  • crates/biome_cli/src/reporter/terminal.rs
  • crates/biome_cli/src/runner/impls/finalizers/default.rs
  • crates/biome_cli/tests/cases/mod.rs
  • crates/biome_cli/tests/cases/reporter_concise.rs
  • crates/biome_diagnostics/src/display.rs

Comment thread crates/biome_diagnostics/src/display.rs Outdated
Comment thread crates/biome_diagnostics/src/display.rs Outdated
@ematipico ematipico force-pushed the feat/reporter-concise branch from a610336 to 3a725e3 Compare March 18, 2026 11:54
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
crates/biome_diagnostics/src/display.rs (2)

282-287: ⚠️ Potential issue | 🟡 Minor

Avoid unconditional ": " separators in concise output.

Line 282 and Line 287 always print delimiters, so diagnostics without location/category render as awkward placeholders (for example ✖ : ...).

💡 Proposed fix
-    // Print file location with hyperlink
-    print_file_location(fmt, diagnostic)?;
-
-    fmt.write_str(": ")?;
-
-    // Print category with hyperlink
-    print_category(fmt, diagnostic)?;
-
-    fmt.write_str(": ")?;
+    let has_file = matches!(diagnostic.location().resource, Some(Resource::File(_)));
+    if has_file {
+        print_file_location(fmt, diagnostic)?;
+        fmt.write_str(": ")?;
+    }
+
+    if diagnostic.category().is_some() {
+        print_category(fmt, diagnostic)?;
+        fmt.write_str(": ")?;
+    }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_diagnostics/src/display.rs` around lines 282 - 287, The code
unconditionally emits the ": " separators around the category which causes stray
delimiters when location or category are missing; change the printing flow so
separators are only written when the adjacent component actually produced output
— for example modify print_location(...) and print_category(...) to return a
bool (or provide a helper like wrote_something()) and then wrap fmt.write_str(":
")? calls in if checks (e.g. if print_location(fmt, diagnostic) { if
print_category(fmt, diagnostic) { fmt.write_str(": ")? } } or more simply track
a local wrote_any flag and only write ": " when the previous component returned
true); update calls around print_category(fmt, diagnostic) and any
fmt.write_str(": ")? uses to use this conditional logic.

195-197: ⚠️ Potential issue | 🟡 Minor

Gate header spacing on actual file resources.

On Line 195, resource.is_some() is broader than what Line 193 prints. For non-file resources, this leaves a stray leading space.

💡 Proposed fix
-        let has_file = diagnostic.location().resource.is_some();
+        let has_file = matches!(diagnostic.location().resource, Some(Resource::File(_)));
         if has_file {
             fmt.write_str(" ")?;
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_diagnostics/src/display.rs` around lines 195 - 197, The code
currently sets has_file using diagnostic.location().resource.is_some(), which
adds a space for any resource type and causes a stray space for non-file
resources; change the condition to detect actual file resources (e.g., use
diagnostic.location().resource.as_ref().map_or(false, |r| r.is_file()) or match
on Resource::File) so the leading space (the fmt.write_str call) is only emitted
when the resource is a file; update the has_file binding and keep the
fmt.write_str(" ") call tied to that refined check.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/add-concise-reporter.md:
- Line 5: Update the sentence in .changeset/add-concise-reporter.md to read
exactly: “When `--reporter=concise` is passed to the commands `format`, `lint`,
`check`, and `ci`, the diagnostics are printed in a compact manner:” — replace
the existing line (which currently omits “to”) with this wording, keeping the
reporter name `concise` and the command list `format`, `lint`, `check`, and `ci`
unchanged to preserve clarity and brevity.

---

Duplicate comments:
In `@crates/biome_diagnostics/src/display.rs`:
- Around line 282-287: The code unconditionally emits the ": " separators around
the category which causes stray delimiters when location or category are
missing; change the printing flow so separators are only written when the
adjacent component actually produced output — for example modify
print_location(...) and print_category(...) to return a bool (or provide a
helper like wrote_something()) and then wrap fmt.write_str(": ")? calls in if
checks (e.g. if print_location(fmt, diagnostic) { if print_category(fmt,
diagnostic) { fmt.write_str(": ")? } } or more simply track a local wrote_any
flag and only write ": " when the previous component returned true); update
calls around print_category(fmt, diagnostic) and any fmt.write_str(": ")? uses
to use this conditional logic.
- Around line 195-197: The code currently sets has_file using
diagnostic.location().resource.is_some(), which adds a space for any resource
type and causes a stray space for non-file resources; change the condition to
detect actual file resources (e.g., use
diagnostic.location().resource.as_ref().map_or(false, |r| r.is_file()) or match
on Resource::File) so the leading space (the fmt.write_str call) is only emitted
when the resource is a file; update the has_file binding and keep the
fmt.write_str(" ") call tied to that refined check.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ca067eb8-50d2-43a1-8904-6fe7922d7b50

📥 Commits

Reviewing files that changed from the base of the PR and between a610336 and 3a725e3.

⛔ Files ignored due to path filters (10)
  • crates/biome_cli/tests/snapshots/main_cases_help/check_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_help/ci_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_help/format_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_help/lint_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_help/migrate_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_help/rage_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_reporter_concise/reports_diagnostics_concise_check_command.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_reporter_concise/reports_diagnostics_concise_ci_command.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_reporter_concise/reports_diagnostics_concise_format_command.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_reporter_concise/reports_diagnostics_concise_lint_command.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (7)
  • .changeset/add-concise-reporter.md
  • crates/biome_cli/src/cli_options.rs
  • crates/biome_cli/src/reporter/terminal.rs
  • crates/biome_cli/src/runner/impls/finalizers/default.rs
  • crates/biome_cli/tests/cases/mod.rs
  • crates/biome_cli/tests/cases/reporter_concise.rs
  • crates/biome_diagnostics/src/display.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • crates/biome_cli/src/reporter/terminal.rs
  • crates/biome_cli/tests/cases/reporter_concise.rs
  • crates/biome_cli/src/cli_options.rs

"@biomejs/biome": minor
---

Added a new reporter called `concise`. When `--reporter=concise` is passed the commands `format`, `lint`, `check` and `ci`, the diagnostics are printed in a compact manner:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Tiny wording tweak for clarity (and fewer raised eyebrows).

Please adjust the sentence to: “When --reporter=concise is passed to the commands format, lint, check, and ci…”.

Based on learnings: "Changeset descriptions should be concise (1-3 sentences), user-facing".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.changeset/add-concise-reporter.md at line 5, Update the sentence in
.changeset/add-concise-reporter.md to read exactly: “When `--reporter=concise`
is passed to the commands `format`, `lint`, `check`, and `ci`, the diagnostics
are printed in a compact manner:” — replace the existing line (which currently
omits “to”) with this wording, keeping the reporter name `concise` and the
command list `format`, `lint`, `check`, and `ci` unchanged to preserve clarity
and brevity.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
crates/biome_diagnostics/src/display.rs (1)

127-144: Minor cosmetic issue: double space for JetBrains terminals in concise mode.

print_concise writes a space after the icon (line 278), then calls print_file_location. The JetBrains branch adds another leading space via " at {name}", resulting in ✖ at path:1:1.

This only affects JetBrains IDE terminal users, but worth a quick fix if you're in there anyway.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_diagnostics/src/display.rs` around lines 127 - 144, The
JetBrains branch in print_file_location/Display code adds a leading space via
format!(" at {name}") which, combined with print_concise's already-added space
after the icon, yields a double space; remove the extra leading space by
changing the JetBrains branch to print "at {name}" (no leading space) or
otherwise emit "at " + name so the caller's spacing remains correct; update the
branch that checks is_jetbrains (the code that currently does
fmt.write_str(&format!(" at {name}"))?) to emit without the leading space.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@crates/biome_diagnostics/src/display.rs`:
- Around line 127-144: The JetBrains branch in print_file_location/Display code
adds a leading space via format!(" at {name}") which, combined with
print_concise's already-added space after the icon, yields a double space;
remove the extra leading space by changing the JetBrains branch to print "at
{name}" (no leading space) or otherwise emit "at " + name so the caller's
spacing remains correct; update the branch that checks is_jetbrains (the code
that currently does fmt.write_str(&format!(" at {name}"))?) to emit without the
leading space.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5fad53e1-900d-4231-83ec-dff736ced3ee

📥 Commits

Reviewing files that changed from the base of the PR and between 3a725e3 and 6898165.

📒 Files selected for processing (1)
  • crates/biome_diagnostics/src/display.rs

@ematipico ematipico added this to the Biome v2.5 milestone Mar 23, 2026
@ematipico ematipico merged commit f0615fd into next Mar 23, 2026
13 checks passed
@ematipico ematipico deleted the feat/reporter-concise branch March 23, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Diagnostic Area: diagnostocis

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants