Skip to content

fix(reporters): always print the issue-type title for a single group#1848

Merged
webpro merged 1 commit into
webpro-nl:mainfrom
morgan-coded:freshness/knip-1793
Jul 2, 2026
Merged

fix(reporters): always print the issue-type title for a single group#1848
webpro merged 1 commit into
webpro-nl:mainfrom
morgan-coded:freshness/knip-1793

Conversation

@morgan-coded

Copy link
Copy Markdown
Contributor

The default and compact reporters gate the issue-type heading behind reportMultipleGroups, so a single issue type prints without its title or count. This drops that gate in both reporters so the group title and count always show. Other reporters are unchanged.

Fixes #1793

Copilot AI review requested due to automatic review settings July 1, 2026 19:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the symbols (default) and compact reporters consistently print the issue-type heading (with count) even when only a single issue type is being reported, addressing #1793 and keeping output shape stable for --include / --strict runs.

Changes:

  • Remove the reportMultipleGroups gating so issue-type headings are printed for single-group runs in symbols and compact reporters.
  • Tighten/extend CLI reporter tests to assert the presence of the heading + count for single-group output.
  • Update an existing symbols --directory test expectation to include the heading + count.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/knip/src/reporters/symbols.ts Always prints the issue-type heading/count for reported groups (including single-group runs).
packages/knip/src/reporters/compact.ts Always prints the issue-type heading/count for reported groups (including single-group runs).
packages/knip/test/cli/cli-reporter-symbols-single-group.test.ts Adds coverage for symbols reporter single included issue-type output including heading/count.
packages/knip/test/cli/cli-reporter-symbols-directory.test.ts Updates expected output to include heading/count for single-group files report.
packages/knip/test/cli/cli-reporter-compact.test.ts Strengthens expectations to assert heading/count for compact reporter output (including single-group include).

@pkg-pr-new

pkg-pr-new Bot commented Jul 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/knip@1848
npm i https://pkg.pr.new/@knip/language-server@1848
npm i https://pkg.pr.new/@knip/mcp@1848

commit: d82de0b

@webpro webpro merged commit cf997b2 into webpro-nl:main Jul 2, 2026
30 checks passed
@webpro

webpro commented Jul 2, 2026

Copy link
Copy Markdown
Member

Thank you! 👍

@webpro

webpro commented Jul 2, 2026

Copy link
Copy Markdown
Member

🚀 This pull request is included in v6.24.0. See Release 6.24.0 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Default/compact reporters omit issue-type title and count when only one type is reported

3 participants