feat(issues): add --state ignored to list ignored issues OD-318#28
Conversation
Add `codacy issues --state <active|ignored>` (-S). The new `ignored` state lists issues marked as ignored on Codacy via the dedicated `searchRepositoryIgnoredIssues` endpoint, reusing all existing filters and the paginate-to-limit loop. `active` is the default, so existing behavior is unchanged. Renders an ignored-issue card (via new `printIgnoredIssueCard`) showing reason, who ignored it, when, and any comment; guards against `--overview`/`--ignore`; supports `--output json`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | -3 |
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Code Review
This pull request introduces a new --state <active|ignored> (-S) option to the codacy issues command, allowing users to list issues that have been marked as ignored on Codacy. It integrates the dedicated searchRepositoryIgnoredIssues API endpoint, supports existing filters, and implements a new card renderer (printIgnoredIssueCard) to display ignore metadata such as the reason, author, timestamp, and optional comments. Comprehensive tests and documentation have also been added. There are no review comments, and no feedback is provided.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for viewing ignored issues via the --state flag. While functionally complete and correctly integrated with the relevant API endpoints, the automated analysis indicates the PR is not up to standards. The primary concerns are code duplication (clones) between active and ignored issue card rendering and high complexity in the new test blocks. Addressing the duplication in src/utils/formatting.ts and refactoring mock data in src/commands/issues.test.ts are recommended to meet quality requirements.
About this PR
- The PR is currently failing quality standards. The new logic for ignored issues duplicates significant portions of the existing active issues formatting. Refactoring the shared card components is necessary to reduce the technical debt introduced by this feature.
Test suggestions
- Verify listing ignored issues renders metadata line and comments correctly in table output
- Verify filters (e.g. severities, categories) are correctly passed to the ignored issues API endpoint
- Verify pagination logic works and shows a warning when more issues exist beyond the limit
- Verify JSON output contains only the projected fields defined in the design
- Verify error is thrown when combining --state ignored with --overview
- Verify error is thrown when combining --state ignored with --ignore
- Verify default command (no --state) still hits the active issues endpoint
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
…st mock - Extract shared printIssueCardBody() so printIssueCard and printIgnoredIssueCard no longer duplicate the header/message/file-line block (clears the duplication clones flagged by Codacy). - Hoist mockIgnoredIssues to module scope, matching the other test mocks, so the "--state ignored" describe callback drops below the NLOC complexity limit. No behavior change; output is byte-identical. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…uide Record that printIgnoredIssueCard deliberately omits the false-positive warning (the ignore reason already conveys FP status) and that the shared layout lives in printIssueCardBody, so reviewers stop flagging it as a parity gap. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-ignored Address PR feedback on the ignored-issues work: - Replace the `--state <active|ignored>` selector with a boolean `-i, --ignored` flag, for consistency with the existing `--false-positives` filter. Omitting it keeps the active-issues behavior unchanged. - Add a confirmation prompt before `--ignore` bulk-ignores matching issues: it prints the count and only proceeds on `y`, guarding against a mistyped or too-broad filter. `-y, --skip-confirmation` bypasses the prompt for CI/scripts (reuses the shared `confirmAction`, which aborts on a non-TTY when the flag is absent rather than ignoring by accident). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What
Adds
codacy issues --state <active|ignored>(-S) — a read-only way to list issues that were marked as ignored on Codacy.--statedefaults toactive, socodacy issues …behaves exactly as before. Pass--state ignoredto see the ignored ones.How
searchRepositoryIgnoredIssuesendpoint (.../ignoredIssues/search), which accepts the same filter body as the normal search — so--branch,--patterns,--tools,--severities,--categories,--languages,--tags,--authors,--limit, and--false-positivesall pass through unchanged (reusesbuildFilterBody+ the paginate-to---limitloop).printIgnoredIssueCardinutils/formatting.ts— a variant ofprintIssueCard, sinceIgnoredIssuehas no numericresultDataId(shows the stringissueId) and carries ignore metadata (Ignored as <reason> by <name> · <date>+ optionalComment:).--overview(no ignored-issues overview endpoint) or--ignore(already ignored).--false-positivesis intentionally allowed.--output jsonemits{ ignoredIssues: [...] }projected viapickDeepto the shown fields.Design decisions (consistency + UX)
issues, not a new command —issuesalready models sub-modes (--overview,--ignore,--false-positives); a new command would duplicate all the filter-parsing plumbing.--state active|ignoredselector rather than a--ignoredboolean — a boolean would sit one case-flip away from the existing-I/--ignore(opposite effect), an easy footgun.-Sbecause-sis--severities(the repo's uppercase-when-taken rule). Theactivedefault keeps full backward compatibility.stateoverstatus— "status" is already used in the codebase for analysis status.issue --unignore; there is no bulk-unignore endpoint (a possible fast-follow, sinceIgnoredIssuecarries the stringissueId).Testing
--false-positivesallowed, pagination + warning, JSON projection, invalid--state, both guards, and a regression that bareissuesstill hits the active endpoint.check-typesclean.codacy/codacy-cloud-cli: table, JSON, and guard paths all behave as designed.Changeset: minor (new capability on an existing command, non-breaking — matches how comparable additions were versioned).
🤖 Generated with Claude Code