Skip to content

Commit 36c0655

Browse files
committed
Add Codacy Cloud path exclusions
1 parent 5a55246 commit 36c0655

4 files changed

Lines changed: 131 additions & 5 deletions

File tree

.agents/sow/current/SOW-0015-20260605-codacy-scope-and-maintainability.md

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Facts:
2323
- Codacy Cloud currently reports 0 issues, 88% coverage, 42% complex files, and 41% duplicated files for commit `dbf77a8595b01e3e335db41883d2d5f8b72dfac7`.
2424
- `.codacy/codacy.config.json` currently has top-level `"exclude": []`, so test and benchmark paths are not globally excluded in the committed local Codacy configuration.
2525
- The installed Codacy Cloud CLI skill states that committing `.codacy/codacy.config.json` does not by itself change Codacy Cloud; `codacy tools ... --import` is required.
26+
- Codacy's official Cloud configuration file documentation says Cloud path ignores come from a repository-root `.codacy.yml` or `.codacy.yaml` file with `exclude_paths`, not from `.codacy/codacy.config.json`.
2627
- `SOW-0013` recorded the decision to keep complexity and duplication metrics active and fix real source hotspots.
2728
- `SOW-0014` already implemented substantial production-source organization work, including C protocol splits, Rust/Go lookup codec splits, Rust raw service splits, and C service splits.
2829

@@ -63,6 +64,7 @@ Current state:
6364
- Codacy Cloud metrics are: 0 issues, 107960 LOC, 88% coverage, 42% complex files, and 41% duplicated files.
6465
- Codacy Cloud goals are: max duplicated files 10%, max complex files 10%, file duplication block threshold 1, and file complexity value threshold 20.
6566
- `.codacy/codacy.config.json` has partial Opengrep tool-specific excludes for a few Windows fixture files, but top-level global excludes are empty.
67+
- Codacy Cloud API `listIgnoredFiles` reports `hasCodacyConfigurationFile: false` for commit `5a55246b9b4698317bdf8440c898369034a1f408`, proving Cloud did not treat `.codacy/codacy.config.json` as the repository-level Cloud configuration file.
6668
- CodeQL is intentionally broader and still scans `src`, `tests`, and `bench`; this SOW is about Codacy maintainability scope, not weakening GitHub code scanning.
6769

6870
Risks:
@@ -89,12 +91,16 @@ Evidence reviewed:
8991
- `SOW-0014` records completed C/Rust/Go production-source organization work and says further complexity or duplication work should start from fresh Codacy/GitHub evidence.
9092
- Codacy Cloud CLI repository query reports current metrics for commit `dbf77a8595b01e3e335db41883d2d5f8b72dfac7`.
9193
- Codacy Cloud CLI skill states `.codacy/codacy.config.json` is local-only until imported with `codacy tools ... --import`.
94+
- Codacy official docs state Cloud repository configuration uses root `.codacy.yml` or `.codacy.yaml`, starting with `---`, and path ignores are defined under `exclude_paths`.
95+
- Codacy Cloud API file queries after commit `5a55246b9b4698317bdf8440c898369034a1f408` still list `tests/**`, `bench/**`, Go `*_test.go`, and Rust `*_tests.rs` files in complexity and duplication data.
9296

9397
Affected contracts and surfaces:
9498

9599
- Local Codacy configuration file `.codacy/codacy.config.json`.
100+
- Cloud Codacy configuration file `.codacy.yml`.
96101
- Codacy Cloud repository configuration after import.
97102
- Codacy Cloud maintainability metrics and issue scope.
103+
- GitHub Codacy local-analysis workflow trigger paths.
98104
- SOW lifecycle records.
99105
- No protocol, API, wire format, runtime behavior, or public SDK behavior should change during the exclusion step.
100106

@@ -119,15 +125,18 @@ Sensitive data handling plan:
119125
Implementation plan:
120126

121127
1. Update `.codacy/codacy.config.json` global excludes to include `tests/**` and `bench/**`.
122-
2. Validate JSON syntax and run local Codacy analysis enough to prove the config is accepted.
123-
3. Commit and push the configuration and SOW record.
124-
4. Import the committed Codacy configuration into Codacy Cloud and trigger reanalysis.
125-
5. Record refreshed Codacy metrics.
126-
6. Select the next production-file maintainability target from refreshed Codacy data or local production-source approximation if Codacy does not expose contributors.
128+
2. Add root `.codacy.yml` with Cloud-native `exclude_paths` for test and benchmark files.
129+
3. Add `.codacy.yml` and `.codacy.yaml` to the Codacy local-analysis workflow path filters.
130+
4. Validate JSON/YAML syntax and run local Codacy analysis enough to prove the config is accepted.
131+
5. Commit and push the configuration and SOW record.
132+
6. Import the committed Codacy tool configuration into Codacy Cloud and trigger reanalysis.
133+
7. Record refreshed Codacy metrics.
134+
8. Select the next production-file maintainability target from refreshed Codacy data or local production-source approximation if Codacy does not expose contributors.
127135

128136
Validation plan:
129137

130138
- `jq empty .codacy/codacy.config.json`
139+
- YAML parser check for `.codacy.yml`.
131140
- `codacy-analysis analyze --output-format json` with the updated configuration.
132141
- `codacy tools gh netdata plugin-ipc --import -y`
133142
- `codacy repository gh netdata plugin-ipc --reanalyze`
@@ -192,6 +201,43 @@ Open decisions:
192201
- cppcheck: 45 files, 0 issues.
193202
- ShellCheck: 3 files, 0 issues.
194203
- Spectral: 10 files, 0 issues.
204+
- Committed and pushed `5a55246b9b4698317bdf8440c898369034a1f408`.
205+
- Imported `.codacy/codacy.config.json` to Codacy Cloud.
206+
- The import temporarily disabled Cloud Revive because the local file did not contain Revive. Revive was immediately re-enabled in Cloud.
207+
- Added Revive back to `.codacy/codacy.config.json` with the 21 enabled Cloud Revive patterns so future tool imports do not disable it again.
208+
- Verified local Codacy Analysis CLI `0.8.0` is the latest npm-published version available locally, but its Revive adapter reports a non-fatal `findings is not iterable` invocation error even when scanning one Go file. The Revive binary itself runs, and Cloud Revive remains enabled.
209+
- Checked Codacy Cloud after commit `5a55246b9b4698317bdf8440c898369034a1f408`:
210+
- latest analyzed commit: `5a55246b9b4698317bdf8440c898369034a1f408`.
211+
- metrics stayed at 0 issues, 88% coverage, 42% complex files, and 41% duplicated files.
212+
- `listIgnoredFiles` reported `hasCodacyConfigurationFile: false` and only one ignored file: `bench/drivers/go/go.mod`.
213+
- Queried Codacy Cloud file metrics through the generated API client:
214+
- `bench/drivers/go/main_windows.go`: complexity 321, duplication 1706.
215+
- `bench/drivers/c/bench_windows.c`: complexity 292, duplication 1357.
216+
- `tests/fixtures/c/test_uds.c`: complexity 281, duplication 2445.
217+
- `src/go/pkg/netipc/transport/posix/uds_test.go`: complexity 257, duplication 4091.
218+
- `src/crates/netipc/src/service/raw_unix_tests.rs`: complexity 329.
219+
- Added Cloud-native `.codacy.yml` with `exclude_paths` for:
220+
- `bench/**`
221+
- `benchmarks-*`
222+
- `tests/**`
223+
- `**/*_test.go`
224+
- `**/*_tests.rs`
225+
- `**/tests.rs`
226+
- Added `.codacy.yml` and `.codacy.yaml` to the Codacy local-analysis workflow path filters.
227+
- Validated the new local state:
228+
- `.codacy.yml` parses as YAML and contains the intended `exclude_paths`.
229+
- `.codacy/codacy.config.json` parses as JSON and now includes Revive with 21 patterns.
230+
- `git diff --check` passed.
231+
- `bash .agents/sow/audit.sh` passed.
232+
- `codacy-analysis analyze . --output-format json` exited with Codacy analysis status 0, produced 0 issues, and produced 1 known Revive adapter error:
233+
- Checkov: success, 11 files, 0 issues.
234+
- Opengrep/Semgrep: success, 265 files, 0 issues.
235+
- Trivy: success, 266 files, 0 issues.
236+
- cppcheck: success, 45 files, 0 issues.
237+
- ShellCheck: success, 3 files, 0 issues.
238+
- Spectral: success, 11 files, 0 issues.
239+
- Revive: partial, 90 files, 0 issues, 1 `findings is not iterable` invocation error.
240+
- The previous pushed commit `5a55246b9b4698317bdf8440c898369034a1f408` has green CI for CodeQL, Static Analysis, Supply Chain Security, Codacy Local Analysis, Codacy Coverage, and the Codacy GitHub check.
195241

196242
## Validation
197243

.codacy.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
exclude_paths:
3+
- "bench/**"
4+
- "benchmarks-*"
5+
- "tests/**"
6+
- "**/*_test.go"
7+
- "**/*_tests.rs"
8+
- "**/tests.rs"

.codacy/codacy.config.json

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8180,6 +8180,74 @@
81808180
"patternId": "spectral_typed-enum"
81818181
}
81828182
]
8183+
},
8184+
{
8185+
"toolId": "Revive",
8186+
"patterns": [
8187+
{
8188+
"patternId": "Revive_unsecure-url-scheme"
8189+
},
8190+
{
8191+
"patternId": "Revive_imports-blocklist"
8192+
},
8193+
{
8194+
"patternId": "Revive_unchecked-type-assertion"
8195+
},
8196+
{
8197+
"patternId": "Revive_datarace"
8198+
},
8199+
{
8200+
"patternId": "Revive_unconditional-recursion"
8201+
},
8202+
{
8203+
"patternId": "Revive_context-as-argument"
8204+
},
8205+
{
8206+
"patternId": "Revive_context-keys-type"
8207+
},
8208+
{
8209+
"patternId": "Revive_indent-error-flow"
8210+
},
8211+
{
8212+
"patternId": "Revive_receiver-naming"
8213+
},
8214+
{
8215+
"patternId": "Revive_increment-decrement"
8216+
},
8217+
{
8218+
"patternId": "Revive_unexported-return"
8219+
},
8220+
{
8221+
"patternId": "Revive_dot-imports"
8222+
},
8223+
{
8224+
"patternId": "Revive_range"
8225+
},
8226+
{
8227+
"patternId": "Revive_time-naming"
8228+
},
8229+
{
8230+
"patternId": "Revive_unreachable-code"
8231+
},
8232+
{
8233+
"patternId": "Revive_blank-imports"
8234+
},
8235+
{
8236+
"patternId": "Revive_error-return"
8237+
},
8238+
{
8239+
"patternId": "Revive_var-declaration"
8240+
},
8241+
{
8242+
"patternId": "Revive_errorf"
8243+
},
8244+
{
8245+
"patternId": "Revive_superfluous-else"
8246+
},
8247+
{
8248+
"patternId": "Revive_error-naming"
8249+
}
8250+
]
81838251
}
81848252
],
81858253
"exclude": [

.github/workflows/codacy-analysis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches:
66
- main
77
paths:
8+
- .codacy.yml
9+
- .codacy.yaml
810
- .codacy/**
911
- .github/workflows/codacy-analysis.yml
1012
- AGENTS.md
@@ -20,6 +22,8 @@ on:
2022
branches:
2123
- main
2224
paths:
25+
- .codacy.yml
26+
- .codacy.yaml
2327
- .codacy/**
2428
- .github/workflows/codacy-analysis.yml
2529
- AGENTS.md

0 commit comments

Comments
 (0)