Skip to content

Commit fc889c7

Browse files
committed
feat: add bulk enable disable patterns
1 parent 1deacd2 commit fc889c7

File tree

5 files changed

+509
-65
lines changed

5 files changed

+509
-65
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ codacy <command> --help # Detailed usage for any command
5959
| `pull-request <provider> <org> <repo> <pr>` | Show PR analysis, issues, diff coverage, and changed files; or reanalyze it |
6060
| `tools <provider> <org> <repo>` | List analysis tools configured for a repository |
6161
| `tool <provider> <org> <repo> <tool>` | Enable, disable, or configure an analysis tool |
62-
| `patterns <provider> <org> <repo> <tool>` | List patterns for a tool with filters |
62+
| `patterns <provider> <org> <repo> <tool>` | List patterns for a tool, or bulk enable/disable them |
6363
| `pattern <provider> <org> <repo> <tool> <id>` | Enable, disable, or set parameters for a pattern |
6464

6565
Provider shortcodes: `gh` (GitHub), `gl` (GitLab), `bb` (Bitbucket).

SPECS/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,4 @@ _No pending tasks._ All commands implemented.
6161
| 2026-03-02 | `issue --ignore`, `pull-request --ignore-issue` / `--ignore-all-false-positives`, `finding --ignore` + tests (17 new tests, 164 total); all use `-R/--ignore-reason` and `-m/--ignore-comment` options |
6262
| 2026-03-05 | Analysis status in `repository` and `pull-request` About sections using `formatAnalysisStatus()`; `--reanalyze` option for both commands (13 new tests, 185 total) |
6363
| 2026-03-05 | JSON output filtering with `pickDeep` across all commands: `info`, `repositories`, `repository`, `pull-request`, `issues`, `issue`, `findings`, `finding`, `tools`, `patterns`; documented pattern in `src/commands/CLAUDE.md` |
64+
| 2026-03-12 | `patterns --enable-all` / `--disable-all` bulk update with filter support (6 new tests, 196 total) |

SPECS/commands/tools-and-patterns.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,16 @@ File: `src/commands/tool.test.ts` — 9 tests.
9090

9191
## Purpose
9292

93-
List patterns for a specific tool in a repository, with optional filters.
93+
List patterns for a specific tool in a repository, with optional filters. Also supports bulk enabling/disabling matching patterns.
9494

9595
## Usage
9696

9797
```
9898
codacy patterns <provider> <organization> <repository> <toolName>
9999
codacy patterns gh my-org my-repo eslint --severities Critical,High --enabled
100100
codacy patterns gh my-org my-repo eslint --output json
101+
codacy patterns gh my-org my-repo eslint --enable-all --categories Security
102+
codacy patterns gh my-org my-repo eslint --disable-all --severities Minor
101103
```
102104

103105
## Options
@@ -109,16 +111,22 @@ codacy patterns gh my-org my-repo eslint --output json
109111
| `--severities <severities>` | `-s` | Comma-separated severity levels |
110112
| `--tags <tags>` | `-t` | Comma-separated tag names |
111113
| `--search <term>` | `-q` | Search term |
112-
| `--enabled` | `-e` | Show only enabled patterns |
113-
| `--disabled` | `-D` | Show only disabled patterns |
114+
| `--enabled` | `-e` | Show only enabled patterns (list mode only) |
115+
| `--disabled` | `-D` | Show only disabled patterns (list mode only) |
114116
| `--recommended` | `-r` | Show only recommended patterns |
117+
| `--enable-all` | `-E` | Bulk enable matching patterns |
118+
| `--disable-all` | `-X` | Bulk disable matching patterns |
115119

116120
## API Endpoints
117121

118122
1. [`listRepositoryTools`](https://api.codacy.com/api/api-docs#listrepositorytools) — to resolve tool name to UUID
119-
2. [`listRepositoryToolPatterns`](https://api.codacy.com/api/api-docs#listrepositorytoolpatterns)`AnalysisService.listRepositoryToolPatterns(...)`
123+
2. [`listRepositoryToolPatterns`](https://api.codacy.com/api/api-docs#listrepositorytoolpatterns) — list mode
124+
3. [`updateRepositoryToolPatterns`](https://api.codacy.com/api/api-docs#updaterepositorytoolpatterns) — bulk update mode (`--enable-all` / `--disable-all`)
125+
4. [`toolPatternsOverview`](https://api.codacy.com/api/api-docs#toolpatternsoverview) — fetched after bulk update to show summary counts
120126

121-
## Output
127+
## Modes
128+
129+
### List mode (default)
122130

123131
Card-style format, sorted by severity (Critical > High > Medium > Minor), then recommended (true first), then title alphabetically:
124132

@@ -138,9 +146,18 @@ Card-style format, sorted by severity (Critical > High > Medium > Minor), then r
138146

139147
Shows pagination warning if more than 100 results exist.
140148

149+
### Bulk update mode (`--enable-all` / `--disable-all`)
150+
151+
Enables or disables all patterns matching the applied filters (languages, categories, severities, tags, search, recommended). The `--enabled`/`--disabled` filter is not used in bulk update mode since it would be redundant. `--enable-all` and `--disable-all` are mutually exclusive.
152+
153+
After the update, fetches the tool patterns overview and shows a summary:
154+
```
155+
✔ Enabled matching ESLint patterns. 120/200 patterns now enabled.
156+
```
157+
141158
## Tests
142159

143-
File: `src/commands/patterns.test.ts`12 tests.
160+
File: `src/commands/patterns.test.ts`23 tests.
144161

145162
---
146163

0 commit comments

Comments
 (0)