Skip to content

feat(issues): add --state ignored to list ignored issues OD-318#28

Merged
alerizzo merged 4 commits into
mainfrom
feat/list-ignored-issues
Jul 17, 2026
Merged

feat(issues): add --state ignored to list ignored issues OD-318#28
alerizzo merged 4 commits into
mainfrom
feat/list-ignored-issues

Conversation

@claudiacodacy

Copy link
Copy Markdown
Contributor

What

Adds codacy issues --state <active|ignored> (-S) — a read-only way to list issues that were marked as ignored on Codacy.

--state defaults to active, so codacy issues … behaves exactly as before. Pass --state ignored to see the ignored ones.

$ codacy issues --state ignored --limit 5

Ignored Issues — Found 22 issues

Critical | Complexity  2b7d782d922ca6c25479637e4f06d49d
Method (anonymous) has 108 lines of code (limit is 100)

src/commands/tools.ts:74
.action(async function (

Ignored as FalsePositive by alerizzo · 2026-05-27
────────────────────────────────────────

How

  • Backed by the dedicated searchRepositoryIgnoredIssues endpoint (.../ignoredIssues/search), which accepts the same filter body as the normal search — so --branch, --patterns, --tools, --severities, --categories, --languages, --tags, --authors, --limit, and --false-positives all pass through unchanged (reuses buildFilterBody + the paginate-to---limit loop).
  • New printIgnoredIssueCard in utils/formatting.ts — a variant of printIssueCard, since IgnoredIssue has no numeric resultDataId (shows the string issueId) and carries ignore metadata (Ignored as <reason> by <name> · <date> + optional Comment:).
  • Guards: errors when combined with --overview (no ignored-issues overview endpoint) or --ignore (already ignored). --false-positives is intentionally allowed.
  • --output json emits { ignoredIssues: [...] } projected via pickDeep to the shown fields.

Design decisions (consistency + UX)

  • Mode-flag on issues, not a new commandissues already models sub-modes (--overview, --ignore, --false-positives); a new command would duplicate all the filter-parsing plumbing.
  • --state active|ignored selector rather than a --ignored boolean — a boolean would sit one case-flip away from the existing -I/--ignore (opposite effect), an easy footgun. -S because -s is --severities (the repo's uppercase-when-taken rule). The active default keeps full backward compatibility.
  • state over status — "status" is already used in the codebase for analysis status.
  • View-only scope — unignoring stays with issue --unignore; there is no bulk-unignore endpoint (a possible fast-follow, since IgnoredIssue carries the string issueId).

Testing

  • 11 new tests (476 total, all passing): rendering + metadata/comment, filter pass-through, --false-positives allowed, pagination + warning, JSON projection, invalid --state, both guards, and a regression that bare issues still hits the active endpoint.
  • check-types clean.
  • Verified live against 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

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>
@codacy-production

codacy-production Bot commented Jul 16, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics -3 duplication

Metric Results
Duplication -3

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@gemini-code-assist gemini-code-assist Bot 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.

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.

@codacy-production codacy-production Bot 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 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

Comment thread src/commands/issues.test.ts Outdated
Comment thread src/commands/issues.test.ts Outdated
Comment thread src/utils/formatting.ts Outdated
Comment thread src/utils/formatting.ts
claudiacodacy and others added 2 commits July 16, 2026 13:57
…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>
@claudiacodacy claudiacodacy changed the title feat(issues): add --state ignored to list ignored issues feat(issues): add --state ignored to list ignored issues OD-318 Jul 16, 2026
…-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>
@alerizzo
alerizzo merged commit 440a57f into main Jul 17, 2026
4 checks passed
@alerizzo
alerizzo deleted the feat/list-ignored-issues branch July 17, 2026 15:43
@github-actions github-actions Bot mentioned this pull request Jul 17, 2026
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.

2 participants