You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.2.0: feed measured coverage to the fallow-health report (#12)
## Summary
`report --coverage <path>` (or `report.coverage` in `.code-quality.yml`;
the flag wins) gives Fallow an Istanbul `coverage-final.json` so the
advisory CRAP values use measured coverage instead of the 0 % estimate.
The blocking gate does not change.
- `src/report/coverage.ts`: repository-relative path validation,
directory form, `realpath` containment, regular file + 256 MiB cap,
Istanbul shape check (`path`/`s`/`f`/`fnMap`), `--coverage-root` derived
by scoring ancestor prefixes over the sampled keys (order independent,
longest prefix wins ties).
- fallow-health: `--coverage`/`--coverage-root`, exit 2 accepted only
with coverage, `coverage:` errors get an Istanbul hint, the coverage
directory is excluded from Fallow scans unless it overlaps a configured
path (then only the file is excluded).
- Unmatched coverage paths → one notice, CRAP stays estimated, exit 0.
Missing / malformed / raw V8 input → exit 1 before any tool runs.
- `quality.yml`: opt-in `report` and `coverage-artifact` inputs;
`Validate coverage artifact` before `Check`; `Download coverage`,
`Report`, `Upload quality reports` gated on step outcomes.
- `report.coverage` is kept out of `configHash`; `check` untouched.
- `scripts/integration.ts`: `ts-project report --coverage` row against a
committed Istanbul fixture asserting `istanbul_files_matched >= 1`.
- Docs: README report paragraph, config row, workflow inputs and
"Coverage for CRAP" (same-job and artifact patterns), quality-gate.md.
Version 1.2.0.
## Test plan
- [x] tsc, oxlint, vitest (59 files / 532 tests), build, actionlint,
dogfood `check` PASS
- [x] `node scripts/integration.ts` against the branch image: 14/14 rows
ok including `report --coverage`
- [x] launcher + branch image on a fixture copy: matched 1/1 with a
`/home/runner/work/...` prefix, dir-form via config,
absolute/missing/raw-V8 → exit 1, unmatched → notice + exit 0
- [ ] after merge: push `v1.2.0`, approve the staged npm version
The reusable job checks out the full history, runs the optional setup command, and invokes plain `code-quality check`. Failing findings produce GitHub annotations, and the job summary is written to `GITHUB_STEP_SUMMARY`. It never passes `--update` or `--initialize`, so CI never writes baselines. Knip and the PHP unused checks need installed dependencies before they run: use `setup: pnpm install --frozen-lockfile` for pnpm, `setup: npm ci` for npm, or `setup: composer install` for Composer. The first two create `node_modules/` for Knip; Composer creates `vendor/` for the PHP unused checks.
140
+
The reusable job checks out the full history, runs the optional setup command, and invokes plain `code-quality check`. With `report` enabled, it also downloads the coverage artifact, runs `code-quality report`, and uploads `artifacts/quality` as the `quality-reports` artifact. Failing findings produce GitHub annotations, and the job summary is written to `GITHUB_STEP_SUMMARY`. It never passes `--update` or `--initialize`, so CI never writes baselines. Knip and the PHP unused checks need installed dependencies before they run: use `setup: pnpm install --frozen-lockfile` for pnpm, `setup: npm ci` for npm, or `setup: composer install` for Composer. The first two create `node_modules/` for Knip; Composer creates `vendor/` for the PHP unused checks.
136
141
137
142
## Check selection
138
143
@@ -165,7 +170,7 @@ Initialize a check once with `check --initialize` after reviewing its current fi
165
170
A realistic output block is:
166
171
167
172
```text
168
-
code-quality 1.1.7 · ts, python · 5 checks
173
+
code-quality 1.2.0 · ts, python · 5 checks
169
174
170
175
✔ ts-complexity oxlint 1.82.0 280 findings
171
176
✖ ts-cognitive fallow 3.23.0 18 findings · 2 new
@@ -187,6 +192,8 @@ A realistic output block is:
187
192
188
193
`check`, `baseline`, and `init` accept `--artifacts <dir>` to retain raw tool output plus `stdout.log` and `stderr.log` per adapter. Without it, adapter output stays in a temporary directory and no adapter artifacts or logs are written by default. `report --output <dir>` selects the advisory report directory and defaults to `artifacts/quality/`.
189
194
195
+
`report --coverage <path>` gives Fallow an Istanbul `coverage-final.json` map, or a directory containing that file, so its advisory CRAP values use measured coverage. The repository-relative `report.coverage` configuration key does the same and requires code-quality 1.2.0 or newer; an explicit flag wins. Coverage paths that match no repository file produce a notice and CRAP stays estimated; missing or malformed coverage files still fail. The coverage file's directory is excluded from Fallow scans unless it overlaps a configured source path, in which case only the coverage file is excluded.
196
+
190
197
In GitHub Actions, each regression also emits a `::error file=…` annotation. The current Markdown summary is appended to `GITHUB_STEP_SUMMARY` when that environment variable is available.
191
198
192
199
## Configuration reference
@@ -205,6 +212,7 @@ In GitHub Actions, each regression also emits a `::error file=…` annotation. T
205
212
|`architecture.ts.rulesFile`| repository-relative file path |`.dependency-cruiser.cjs` when it exists; otherwise skipped |
206
213
|`architecture.php.rulesFile`| repository-relative file path |`deptrac.yaml` when it exists; otherwise skipped |
207
214
|`architecture.python.rulesFile`| repository-relative file path |`.importlinter` when it exists; otherwise skipped |
215
+
|`report.coverage`| repository-relative Istanbul map or directory | Unset; requires code-quality 1.2.0 or newer |
208
216
209
217
An explicitly configured architecture file that is missing is an error. Consumer exclusions apply to applicable checks, while tests remain excluded from duplication regardless of the consumer paths.
210
218
@@ -232,6 +240,17 @@ exclude:
232
240
233
241
The Drupal profile discovers custom modules, themes, and profiles and prints a `Notice:` describing the applied defaults. Normal applicable complexity, cognitive-complexity, duplication, and architecture checks run for the detected custom-code languages; PHP `composer-unused` and `composer-require-checker` run with installed Composer dependencies, while PHPStan dead-code analysis is skipped because consumer PHPStan extensions are incompatible with the image.
234
242
243
+
### Coverage for CRAP
244
+
245
+
When tests and the report run in the same job, configure Vitest's `json` coverage reporter (with either the V8 or Istanbul provider), then run:
With the reusable workflow, have the tests job upload the `coverage/` directory as an artifact named `test-coverage`. The quality job must declare `needs: test`, then set `report: true` and `coverage-artifact: test-coverage` as shown above. Raw V8 output is not supported; the input must be the Istanbul map written by the Vitest or Jest JSON reporter.
253
+
235
254
## Version pinning
236
255
237
256
Pin npm consumers to the major launcher version with `npx @runroom/code-quality@1`. Pin Docker consumers to the major image tag `ghcr.io/runroom/code-quality:v1` and the reusable workflow reference `Runroom/code-quality/.github/workflows/quality.yml@v1`. The image carries the exact v1 tool matrix documented in [quality-gate.md](docs/quality-gate.md#v1-tool-pins); the workflow accepts only an `image-tag`, while the registry and repository remain fixed.
Copy file name to clipboardExpand all lines: docs/quality-gate.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -165,6 +165,8 @@ Some supported tree-sitter grammars reject otherwise valid newer syntax. When th
165
165
166
166
`report` is advisory: it retains full Fallow health and semantic-duplication output, complexipy JSON, and jscpd HTML for investigation. Advisory similarity and health reports do not alter the exact jscpd or complexity baselines and do not turn a report-only measurement into an accepted regression.
167
167
168
+
Coverage-backed CRAP remains advisory only and never changes the blocking quality gate.
169
+
168
170
### Output
169
171
170
172
`check` prints one line per failing finding as `file:line:col rule message [new]`, `[worsened P → V]`, or `[stale: was P]`; duplication uses `a:start-end ↔ b:start-end`. `check --all` also prints every current finding with `[baselined]`.
0 commit comments