Skip to content

Commit f662eef

Browse files
og-pixelalerizzoclaude
authored
feat: Add filter and bulk-ignore for FP CF-2412 (#5)
Co-authored-by: Alejandro Rizzo <alerizzo@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent df6a92d commit f662eef

8 files changed

Lines changed: 568 additions & 66 deletions

File tree

SPECS/commands/issues.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ Both accept the same `SearchRepositoryIssuesBody` for filtering.
3333
| `--languages <languages>` | `-l` | Comma-separated language names |
3434
| `--tags <tags>` | `-t` | Comma-separated tag names |
3535
| `--authors <authors>` | `-a` | Comma-separated author emails |
36+
| `--tools <tools>` | `-T` | Comma-separated tool UUIDs or names |
37+
| `--limit <n>` | `-n` | Maximum number of issues (default: 100, max: 1000) |
3638
| `--overview` | `-O` | Show overview counts instead of list |
39+
| `--false-positives [value]` | `-F` | Filter by potential false positives (true, false, or omit) |
40+
| `--ignore` | `-I` | Ignore all issues matching current filters |
41+
| `--ignore-reason <reason>` | `-R` | Reason for ignoring (AcceptedUse, FalsePositive, NotExploitable, TestCode, ExternalCode) |
42+
| `--ignore-comment <comment>` | `-m` | Optional comment when using --ignore |
3743

3844
## Output
3945

@@ -64,4 +70,4 @@ Six count tables sorted descending by count: Category, Severity, Language, Tag,
6470

6571
## Tests
6672

67-
File: `src/commands/issues.test.ts`11 tests.
73+
File: `src/commands/issues.test.ts`39 tests.

package-lock.json

Lines changed: 3 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"prepublishOnly": "npm run update-api && npm run build",
2424
"start": "npx ts-node src/index.ts",
2525
"start:dist": "node dist/index.js",
26-
"fetch-api": "curl https://artifacts.codacy.com/api/codacy-api/52.1.31/apiv3-bundled.yaml -o ./api-v3/api-swagger.yaml --create-dirs",
26+
"fetch-api": "curl https://artifacts.codacy.com/api/codacy-api/55.6.4/apiv3-bundled.yaml -o ./api-v3/api-swagger.yaml --create-dirs",
2727
"generate-api": "rm -rf ./src/api/client && openapi --input ./api-v3/api-swagger.yaml --output ./src/api/client --useUnionTypes --indent 2 --client fetch",
2828
"update-api": "npm run fetch-api && npm run generate-api",
2929
"check-types": "tsc --noEmit"

src/commands/AGENTS.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,19 @@ Several helpers are shared between `repository.ts` and `pull-request.ts` via `ut
131131
- **`--unignore` mode** (`-U`): calls `AnalysisService.updateIssueState` with `{ ignored: false }`; skips rendering issue details
132132
- The API uses the string UUID (`issue.issueId`), not the numeric `resultDataId`, for the `updateIssueState` call
133133

134+
## issues command (`issues.ts`)
135+
136+
- Takes `<provider>`, `<organization>`, and `<repository>` as required arguments
137+
- **List mode** (default): card-style format sorted by severity (Error > High > Warning > Info)
138+
- **Overview mode** (`-O, --overview`): six count tables — Category, Severity, Language, Tag, Pattern, Author
139+
- **Filters**: `--branch`, `--patterns`, `--tools`, `--severities`, `--categories`, `--languages`, `--tags`, `--authors`, `--limit`
140+
- **`--false-positives [value]`** (`-F`): tri-state filter — `true` (default when flag present) sends `onlyPotentialFalsePositives: true`, `false` sends `onlyPotentialFalsePositives: false`, omitted sends nothing
141+
- **`--ignore` mode** (`-I`): fetches all issues matching current filters (all pages), then calls `AnalysisService.bulkIgnoreIssues` in batches of 100
142+
- `-R, --ignore-reason`: `AcceptedUse` (default) | `FalsePositive` | `NotExploitable` | `TestCode` | `ExternalCode`
143+
- `-m, --ignore-comment`: optional free-text comment
144+
- Cannot be combined with `--overview` or `--limit`
145+
- Works with any combination of filters; use `--false-positives --ignore` to ignore only FP issues
146+
134147
## finding command (`finding.ts`)
135148

136149
- Takes `<provider>`, `<organization>`, and `<findingId>` (UUID shown on finding cards) as required arguments — **no `<repository>` argument**

src/commands/issue.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ Examples:
149149
ignoreSpinner.succeed(
150150
`Issue #${issueId} ignored (reason: ${ignoreReason}).`,
151151
);
152+
console.log(
153+
ansis.dim(`Run a new analysis to see changes reflected: codacy repository ${provider} ${organization} ${repository} --reanalyze`),
154+
);
152155
}
153156

154157
if (shouldUnignore) {

0 commit comments

Comments
 (0)