@blundergoat/gruff-ts 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/CONTRIBUTING.md +32 -25
  3. package/README.md +49 -50
  4. package/SECURITY.md +18 -31
  5. package/UPGRADING.md +101 -0
  6. package/bin/gruff-ts +3 -0
  7. package/docs/README.md +11 -10
  8. package/docs/agent-hook.md +32 -35
  9. package/docs/ci-integration.md +38 -24
  10. package/docs/configuration.md +160 -89
  11. package/docs/dashboard.md +12 -13
  12. package/docs/output-formats.md +100 -25
  13. package/docs/philosophy.md +2 -2
  14. package/docs/reports-and-ci.md +14 -172
  15. package/docs/rules.md +126 -98
  16. package/package.json +10 -8
  17. package/src/analyser.ts +817 -323
  18. package/src/baseline-file.ts +867 -0
  19. package/src/baseline-identity.ts +463 -0
  20. package/src/baseline-options.ts +139 -34
  21. package/src/baseline.ts +62 -68
  22. package/src/blocks.ts +512 -336
  23. package/src/changed-regions.ts +380 -79
  24. package/src/check-ignore.ts +28 -13
  25. package/src/class-rules.ts +445 -436
  26. package/src/cli-program.ts +915 -172
  27. package/src/cli.ts +9 -3
  28. package/src/comment-rules.ts +236 -418
  29. package/src/comment-scanner.ts +339 -47
  30. package/src/complexity-metrics.ts +111 -35
  31. package/src/config-load-error.ts +17 -8
  32. package/src/config-parse.ts +291 -98
  33. package/src/config-preservation.ts +81 -26
  34. package/src/config.ts +751 -223
  35. package/src/constants.ts +7 -6
  36. package/src/context-doc-rules.ts +182 -54
  37. package/src/dashboard.ts +88 -23
  38. package/src/dead-code-rules.ts +153 -74
  39. package/src/discovery.ts +493 -140
  40. package/src/doc-rules.ts +602 -126
  41. package/src/duplicate-test-group-rules.ts +359 -0
  42. package/src/findings-helpers.ts +134 -109
  43. package/src/findings.ts +47 -27
  44. package/src/fixture-purpose-rules.ts +194 -50
  45. package/src/github-actions-event-guards.ts +331 -0
  46. package/src/github-actions-rules.ts +328 -121
  47. package/src/hook-contract.ts +681 -255
  48. package/src/init-config.ts +163 -118
  49. package/src/inline-suppressions.ts +340 -0
  50. package/src/limit-band.ts +56 -0
  51. package/src/line-rules.ts +331 -468
  52. package/src/migrate-config.ts +670 -0
  53. package/src/naming-pushers.ts +32 -127
  54. package/src/parsed-script.ts +868 -314
  55. package/src/pillar-summary.ts +56 -40
  56. package/src/profiles.ts +86 -74
  57. package/src/project-config-rules.ts +324 -140
  58. package/src/project-rules.ts +237 -115
  59. package/src/public-exports.ts +102 -38
  60. package/src/report-html.ts +217 -85
  61. package/src/report-renderers.ts +821 -203
  62. package/src/rule-list.ts +166 -46
  63. package/src/rules.ts +100 -104
  64. package/src/safety-rules.ts +191 -132
  65. package/src/scoring.ts +249 -55
  66. package/src/security-flow-rules.ts +791 -115
  67. package/src/selectors.ts +169 -0
  68. package/src/sensitive-data-rules.ts +460 -387
  69. package/src/sensitive-exclusions.ts +435 -0
  70. package/src/source-text.ts +378 -104
  71. package/src/static-analysis-redundant-rules.ts +298 -41
  72. package/src/test-block-rules.ts +343 -253
  73. package/src/text-scans.ts +62 -11
  74. package/src/types.ts +220 -71
  75. package/tsconfig.json +2 -1
  76. package/src/process-exec-metadata.ts +0 -163
  77. package/src/test-fixtures.ts +0 -671
@@ -1,195 +1,37 @@
1
1
  # Reports And CI
2
2
 
3
- This guide covers output formats, exit codes, baselines, GitHub annotations, and
4
- the local dashboard.
3
+ This page used to cover reporting and CI in one place. Each topic now has its
4
+ own page, and the headings below are kept so older links still land somewhere
5
+ useful.
5
6
 
6
7
  ## Exit Codes
7
8
 
8
- `analyse` exits with:
9
-
10
- - `0` when the scan completed and no finding met `--fail-on`.
11
- - `1` when at least one finding met `--fail-on`.
12
- - `2` when diagnostics were produced, such as missing inputs or parse/config
13
- diagnostics.
14
-
15
- Parse diagnostics for TypeScript and JavaScript source use TypeScript's
16
- syntax-only parser, including TSX and JSX modes by extension. They do not run
17
- semantic typechecking.
18
-
19
- Examples:
20
-
21
- ```bash
22
- gruff-ts analyse . --fail-on=none
23
- gruff-ts analyse . --fail-on=error
24
- gruff-ts analyse . --fail-on=warning
25
- ```
9
+ See [Exit Codes](../README.md#exit-codes) in the README, and the
10
+ [hook guide](agent-hook.md#the-model) for `hook`'s own exit codes.
26
11
 
27
12
  ## Machine Output
28
13
 
29
- Full JSON report:
30
-
31
- ```bash
32
- gruff-ts analyse . --format=json --fail-on=none > gruff-report.json
33
- ```
34
-
35
- Hotspot summary:
36
-
37
- ```bash
38
- gruff-ts analyse . --format=hotspot --fail-on=none > gruff-hotspots.json
39
- ```
40
-
41
- Human scan digest:
42
-
43
- ```bash
44
- gruff-ts summary . --fail-on=none
45
- ```
46
-
47
- The summary output includes the scanned path, elapsed duration, total findings,
48
- per-pillar counts, top rules, and top file offenders.
49
-
50
- Schema strings:
51
-
52
- - `gruff.analysis.v2` for full analysis reports.
53
- - `gruff.summary.v2` for `summary --format=json`.
54
- - `gruff.baseline.v1` for baselines.
55
- - `gruff.hotspot.v1` for hotspot output.
56
-
57
- `gruff.analysis.v2` may include an optional `notes` array. Notes are non-fatal:
58
- they explain scan-surface limits without changing exit codes. `diagnostics`
59
- still owns exit `2`.
60
-
61
- Current note types:
62
-
63
- - `no-analysable-files` - a requested path existed but contributed no supported
64
- files, usually because ignore rules excluded everything under it.
65
- - `bounded-deep-scan` - a script file exceeded the deep-scan budget. It still
66
- counts as analysed and text-level rules still run, but deep TypeScript passes,
67
- parse diagnostics, and project-graph retention are skipped for that file.
68
-
69
- The deep-scan budget is `20,000` lines or `2,000,000` UTF-8 bytes, whichever
70
- limit is hit first. Text output prints notes in a `Notes:` block. JSON reports
71
- omit `notes` when there are no notes, so ordinary scans keep the same report
72
- shape.
14
+ JSON, hotspot, SARIF, and summary output, schema strings, notes, and the
15
+ deep-scan budget are in [Output Formats](output-formats.md).
73
16
 
74
17
  ## GitHub Actions
75
18
 
76
- Use GitHub annotation output in a workflow step:
77
-
78
- ```bash
79
- gruff-ts analyse . --format=github --fail-on=warning
80
- ```
81
-
82
- Changed-file modes:
83
-
84
- ```bash
85
- gruff-ts analyse . --diff=working-tree --format=github --fail-on=warning
86
- gruff-ts analyse . --diff=staged --format=github --fail-on=warning
87
- gruff-ts analyse . --diff=origin/main --format=github --fail-on=warning
88
- ```
89
-
90
- `--diff` filters findings to changed files after analysis.
91
-
92
- For SARIF consumers, write SARIF output from `analyse` and upload the generated
93
- file with your platform's code-scanning upload step:
94
-
95
- ```bash
96
- gruff-ts analyse . --format=sarif --fail-on=none > gruff.sarif
97
- ```
98
-
99
- For a strict security-oriented gate, bypass baselines and fail on error-severity
100
- findings:
101
-
102
- ```bash
103
- gruff-ts analyse . --no-baseline --fail-on=error
104
- ```
105
-
106
- This is useful when an adoption baseline exists for general quality debt but
107
- security and sensitive-data errors should still break CI.
19
+ Annotations, SARIF upload, quality gates, and diff scans are in
20
+ [CI Integration](ci-integration.md).
108
21
 
109
22
  ## Baselines
110
23
 
111
- Generate an adoption baseline:
112
-
113
- ```bash
114
- gruff-ts analyse . --generate-baseline gruff-baseline.json --fail-on=none
115
- ```
116
-
117
- Apply it in CI:
118
-
119
- ```bash
120
- gruff-ts analyse . --baseline gruff-baseline.json --fail-on=warning
121
- ```
122
-
123
- Skip automatic baseline discovery:
124
-
125
- ```bash
126
- gruff-ts analyse . --no-baseline --fail-on=none
127
- ```
128
-
129
- Review baseline diffs carefully. A baseline suppresses matching fingerprints, so
130
- unexpected additions can hide findings.
131
-
132
- Known `gruff.baseline.v1` limitation: entries match on `(fingerprint, ruleId,
133
- filePath)`, and the fingerprint hashes the line, not the column. Two distinct
134
- same-line findings from one rule (for example two secrets on one line) are
135
- reported separately since 0.5.0, but they still share a fingerprint and a
136
- baseline matches them as one identity. Pure code movement changes the
137
- fingerprint and resurfaces baselined findings as new. Both are addressed by
138
- the count-based `gruff.baseline.v2` planned for the coordinated cross-analyser
139
- schema release (ADR-013, ADR-017); until then, regenerate the baseline after
140
- moves instead of hand-editing entries.
141
-
142
- `report` intentionally renders raw scan results and does not accept a
143
- `--baseline` option. Use `analyse` for baseline-aware machine output.
24
+ See [Baselines](ci-integration.md#baselines) in CI Integration, and
25
+ [Upgrading](../UPGRADING.md) to migrate a `0.5` baseline.
144
26
 
145
27
  ## HTML Reports
146
28
 
147
- Write a dark self-contained report:
148
-
149
- ```bash
150
- gruff-ts report . --output gruff-report.html
151
- ```
152
-
153
- Write report JSON:
154
-
155
- ```bash
156
- gruff-ts report . --format=json --output gruff-report.json
157
- ```
158
-
159
- `report` defaults to `--fail-on none`, making it suitable for local inspection
160
- and scheduled reporting. `analyse` and `summary` default to `--fail-on advisory`
161
- out of the box; override per-project by setting `minimumSeverity:` in
162
- `.gruff-ts.yaml`. See `docs/configuration.md` and ADR-004 for the precedence
163
- chain (CLI flag > config > binary default).
29
+ See [HTML](output-formats.md#html) in Output Formats.
164
30
 
165
31
  ## Dashboard
166
32
 
167
- Start the dashboard:
168
-
169
- ```bash
170
- gruff-ts dashboard --host 127.0.0.1 --port 8767 --project-root .
171
- ```
172
-
173
- The dashboard serves:
174
-
175
- - `/` - iframe shell and controls panel.
176
- - `/health` - plain `ok`.
177
- - `/scan?projectRoot=<path>&path=<path>` - report HTML for the selected scan.
178
-
179
- Keep the dashboard on loopback unless the network is trusted. The scan endpoint
180
- accepts filesystem paths through request parameters.
33
+ See [Dashboard](dashboard.md).
181
34
 
182
35
  ## Score History
183
36
 
184
- Append score history to a JSON file:
185
-
186
- ```bash
187
- gruff-ts analyse . --history-file .gruff-history.json --fail-on=none
188
- ```
189
-
190
- `--history-file` requires a full scan. Combining it with `--diff`, `--since`, or
191
- `--changed-ranges` exits `2` before anything is written, so a filtered scan can
192
- never append a partial trend point.
193
-
194
- History files are local artifacts. Commit them only if your project explicitly
195
- wants trend data in version control.
37
+ See [Score History](ci-integration.md#score-history) in CI Integration.
package/docs/rules.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # Rules
2
2
 
3
- `gruff-ts` exposes 120 rules across 11 pillars. This list is generated from the
4
- public rule catalogue used by `gruff-ts list-rules`; severity, confidence,
5
- thresholds, and option names are the defaults before project config overrides.
3
+ `gruff-ts` exposes 81 rules across 11 pillars. This list is maintained by hand
4
+ against the public rule catalogue used by `gruff-ts list-rules`; severity,
5
+ confidence, thresholds, and option names are the defaults before project config
6
+ overrides.
6
7
 
7
8
  The pillars are organised around one goal: making AI-generated code something a
8
9
  human who did not write it can verify by reading, trust as secure, and rely on as
@@ -18,33 +19,96 @@ Use the CLI when you need machine-readable metadata:
18
19
  gruff-ts list-rules --format=json
19
20
  ```
20
21
 
22
+ Every medium- and low-confidence rule carries reviewed false-positive guidance:
23
+ the code shapes that trip it without being the defect, and what to do about each
24
+ one. That guidance lives on the rule catalogue rather than in this list, so it
25
+ cannot drift from what the analyser actually ships. Read it per rule with
26
+ `gruff-ts list-rules <rule-id>`, or across the catalogue in the
27
+ `falsePositiveShapes` field of `--format=json`.
28
+
29
+ ## Confidence evidence
30
+
31
+ A rule's confidence follows its measured precision: high at an error-adjusted score of 0.85 or more, medium from 0.70, low below, and a raise needs the lower bound of its 95% interval to clear the new band. These default-on rules have no measurement that sets their confidence, so the value below is inherited, not measured:
32
+
33
+ | Rule | Confidence | Measurement |
34
+ |---|---|---|
35
+ | `dead-code.unused-private-method` | low | unmeasured |
36
+ | `design.circular-import` | medium | insufficient |
37
+ | `design.large-module-concentration` | medium | unmeasured |
38
+ | `design.package-bin-missing` | high | unmeasured |
39
+ | `design.package-bin-not-executable` | high | unmeasured |
40
+ | `docs.fixture-purpose-missing` | medium | insufficient |
41
+ | `docs.missing-error-behavior-doc` | medium | insufficient |
42
+ | `modernisation.date-now-candidate` | high | unmeasured |
43
+ | `modernisation.readonly-property-candidate` | medium | insufficient |
44
+ | `modernisation.tsconfig-exact-optional-disabled` | high | insufficient |
45
+ | `modernisation.tsconfig-index-safety-disabled` | high | insufficient |
46
+ | `modernisation.tsconfig-strict-disabled` | high | insufficient |
47
+ | `naming.class-file-mismatch` | medium | insufficient |
48
+ | `security.async-foreach` | medium | unmeasured |
49
+ | `security.document-write` | high | too-few |
50
+ | `security.dynamic-regexp` | medium | unmeasured |
51
+ | `security.eval-call` | high | insufficient |
52
+ | `security.github-actions-pull-request-target` | medium | too-few |
53
+ | `security.github-actions-remote-shell` | medium | too-few |
54
+ | `security.github-actions-secrets-in-pr` | medium | too-few |
55
+ | `security.remote-install-script` | medium | unmeasured |
56
+ | `security.ssrf-candidate` | medium | too-few |
57
+ | `security.string-timer` | high | unmeasured |
58
+ | `security.weak-crypto` | high | too-few |
59
+ | `security.xxe-candidate` | medium | unmeasured |
60
+ | `sensitive-data.api-key-pattern` | high | unmeasured |
61
+ | `sensitive-data.gcp-service-account-key` | high | too-few |
62
+ | `sensitive-data.phi-pattern` | high | unmeasured |
63
+ | `sensitive-data.pii-pattern` | high | too-few |
64
+ | `sensitive-data.private-key` | high | too-few |
65
+ | `test-quality.static-analysis-redundant-test` | high | unmeasured |
66
+ | `test-quality.trivial-assertion` | high | unmeasured |
67
+ | `test-quality.unused-mock` | medium | unmeasured |
68
+ | `waste.broad-runtime-version` | medium | unmeasured |
69
+ | `waste.unreachable-code` | high | unmeasured |
70
+ | `waste.unused-import` | medium | insufficient |
71
+ | `waste.useless-catch` | high | unmeasured |
72
+
21
73
  Generated source policy: a file whose first 10 lines include an explicit marker
22
74
  such as `AUTO-GENERATED`, `@generated`, `Generated by`, `DO NOT EDIT`, or
23
75
  `Copied from` skips documentation and naming findings only. All other pillars,
24
76
  including security, sensitive-data, size, complexity, and test-quality, still
25
- run. A path segment such as `fixtures`, `testdata`, or `perf-tests` does not by
26
- itself suppress any rule family.
77
+ run. Directory names alone never trigger this generated-file skip; separately,
78
+ security and sensitive-data rules skip test, fixture, and example paths (`test`,
79
+ `tests`, `__tests__`, `spec`, `testdata`, `fixtures`, `examples`, and
80
+ `*.test.*`/`*.spec.*` files) with counted `source: "built-in"` audit rows.
27
81
 
28
82
  ## Pillar Counts
29
83
 
30
- - complexity: 2
84
+ - complexity: 1
31
85
  - dead-code: 1
32
- - design: 5
33
- - documentation: 18
34
- - maintainability: 14
35
- - modernisation: 14
36
- - naming: 10
37
- - security: 29
38
- - sensitive-data: 10
86
+ - design: 4
87
+ - documentation: 15
88
+ - maintainability: 8
89
+ - modernisation: 9
90
+ - naming: 3
91
+ - security: 23
92
+ - sensitive-data: 8
39
93
  - size: 3
40
- - test-quality: 14
94
+ - test-quality: 6
95
+
96
+ **Two bands for size and complexity.** Every `size.*` and `complexity.*` finding
97
+ reports in one of two bands. Below 1.5x its limit, it reports as an `advisory`
98
+ notice regardless of configured severity, sets `metadata.limitBand: "lower"`,
99
+ and advises not to grow the unit further. At 1.5x the limit or above, it keeps
100
+ its configured severity, sets `metadata.limitBand: "upper"`, and advises
101
+ splitting or simplifying. The message text stays identical across both bands so
102
+ the finding keeps its identity if the unit crosses the boundary, and the hook
103
+ payload includes the band beside its measurement. Findings do not suggest raising
104
+ a limit; adjust `rules.<id>.threshold` in `.gruff-ts.yaml` when a project needs
105
+ a different bound (see [Configuration](configuration.md)).
41
106
 
42
107
  ## Complexity
43
108
 
44
- - `complexity.cognitive` (warning; high confidence; threshold 15): Flags syntax-aware decisions plus nested `if`, loop, `switch`, `catch`, and ternary depth. Object literals, callback wrappers, classes, and ordinary blocks do not add nesting; `else if` remains at peer depth and switch cases do not stack.
45
- - `complexity.cyclomatic` (warning; high confidence; threshold 15): Starts at one, then counts each `if`, loop, `catch`, non-default `case`, ternary, `&&`, and `||` syntax node once. The `switch` wrapper, `default`, `??`, optional property/element/call chains, and non-null assertions add zero.
109
+ - `complexity.cyclomatic` (warning; high confidence; threshold 15; off by default since 0.6.0): Starts at one, then counts each `if`, loop, `catch`, ternary, `&&`, and `||` syntax node once, and each `switch` with a non-default `case` once however many cases it has; `metadata.breakdown.case` counts those switches. `default`, `??`, optional property/element/call chains, and non-null assertions add zero.
46
110
 
47
- Both rules consume the same parsed callable measurement as `docs.missing-why-for-complex-code`. A nested callable already reported as its own block is measured separately; an anonymous callback without its own block stays part of the nearest reported owner. Complexity findings retain `metadata.complexity` and `metadata.threshold` and add a fixed `metadata.breakdown` object with `if`, `loop`, `catch`, `case`, `ternary`, `logicalAnd`, `logicalOr`, and `maxNesting` counts.
111
+ `complexity.cyclomatic` shares its parsed callable measurement with `docs.missing-why-for-complex-code`. Alongside declared functions, methods, and `const`/`let` function values, the complexity and function-size rules also measure four extra forms: object-literal `key: function` methods, member-assigned functions (`Calendar.render = function () {}`), `var` function expressions, and immediately invoked functions (named after the key - qualified by its object variable or assignment target, as in `Widget.paint` - the member, the variable, or the invoked function's name / `<iife>`). Documentation and naming rules ignore those four forms. Any nested callable that already has its own block is measured separately; anonymous callbacks stay part of their enclosing owner. Findings include `metadata.complexity`, `metadata.threshold`, and `metadata.breakdown` (`if`, `loop`, `catch`, `case`, `ternary`, `logicalAnd`, `logicalOr`, `maxNesting`).
48
112
 
49
113
  ## Dead Code
50
114
 
@@ -52,32 +116,28 @@ Both rules consume the same parsed callable measurement as `docs.missing-why-for
52
116
 
53
117
  ## Design
54
118
 
55
- - `design.circular-import` (warning; medium confidence): Flags strongly connected relative import components. Each component reports once, anchored on the lexicographically first member path, with sorted member paths and a representative cycle path in metadata. Narrow path scans build root graph context for this rule only, then emit SCCs that include a requested file; per-file rules and `paths.analysedFiles` remain scoped to the requested paths.
56
- - `design.deep-relative-import` (advisory; medium confidence; threshold 2): Flags relative imports that climb too many parent directories.
57
- - `design.large-module-concentration` (advisory; medium confidence; threshold 55; options: minFiles, minLines): Flags a production module that dominates project source lines.
58
- - `design.package-bin-missing` (warning; high confidence): Flags package bin entries that point at missing files.
119
+ - `design.circular-import` (warning; medium confidence): Flags strongly connected relative import components (SCCs). Each component reports once on its lexicographically first member path, with sorted members and a representative cycle path in metadata. Narrow path scans build root graph context for this rule only and emit SCCs touching a requested file, keeping per-file rules and `paths.analysedFiles` scoped to the request.
120
+ - `design.large-module-concentration` (advisory; medium confidence; threshold 55; options: minFiles, minLines): Flags a production module that dominates project source lines. The share counts code lines only: blank, comment-only and decorator-only lines do not count.
121
+ - `design.package-bin-missing` (warning; high confidence): Flags package bin entries that point at missing files; unbuilt `dist/`, `build/`, or `lib/` targets in packages with a `build` script report as `advisory` (even when config sets `warning`).
59
122
  - `design.package-bin-not-executable` (warning; high confidence): Flags package bin targets that are not executable.
60
123
 
61
124
  ## Documentation
62
125
 
63
126
  - `docs.fixture-purpose-missing` (advisory; medium confidence): Flags large or scanner-relevant fixtures without a nearby purpose comment. A comment on or directly above the fixture (or above the test declaration for setup findings) clears it when it uses the purpose vocabulary or is a substantive explanation of eight or more words; stacked `//` headers count as one comment.
64
- - `docs.magic-threshold-without-rationale` (advisory; medium confidence): Flags threshold-like numeric values without a nearby rationale comment.
65
- - `docs.missing-error-behavior-doc` (advisory; medium confidence): Flags commented functions whose error behavior is not described.
66
- - `docs.missing-exported-function-doc` (warning; medium confidence): Flags exported functions without a leading maintainer comment.
127
+ - `docs.missing-error-behavior-doc` (advisory; medium confidence): Flags commented functions whose body contains `throw` and whose comment has no `@throws` tag. Describing the error in other words does not stand in for the tag.
128
+ - `docs.missing-exported-function-doc` (warning; medium confidence): Flags exported functions without a leading maintainer comment; with `everyCallable` on either JSDoc tag rule, also public methods of exported classes.
67
129
  - `docs.missing-file-overview` (advisory; medium confidence): Flags source files without a top-of-file purpose comment.
68
130
  - `docs.missing-interface-doc` (advisory; medium confidence): Flags interfaces without a leading maintainer comment.
69
131
  - `docs.missing-internal-function-doc` (advisory; medium confidence): Flags internal helper functions without a leading maintainer comment.
70
- - `docs.missing-invariant-doc` (advisory; medium confidence): Flags commented declarations that own schema, fingerprint, baseline, or determinism contracts without saying so.
71
- - `docs.missing-param-tag` (advisory; medium confidence): Flags documented exports with parameters missing @param tags.
132
+ - `docs.missing-invariant-doc` (advisory; medium confidence): Flags commented declarations that own schema, fingerprint, baseline, or determinism contracts without saying so. Off by default, because its keyword list cannot accept an accurate comment written in other words: enable it with `rules.docs.missing-invariant-doc.enabled: true`.
133
+ - `docs.missing-param-tag` (advisory; medium confidence; options: everyCallable): Flags non-test documented exports with parameters missing `@param` tags; with `everyCallable`, requires `/** ... */` JSDoc blocks with described `@param` tags across all non-test callables (private and nested functions, class and object methods, default and later exports, single `const` function values, and slash- or block-commented helpers), skipping test files while keeping fixture directories checked.
72
134
  - `docs.missing-public-doc` (advisory; medium confidence): Flags exported class, type, and enum APIs without a nearby doc comment.
73
- - `docs.missing-return-tag` (advisory; medium confidence): Flags documented non-void exports without @returns.
74
- - `docs.missing-side-effect-doc` (advisory; medium confidence): Flags commented functions that perform observable side effects without naming them.
75
- - `docs.missing-why-for-complex-code` (advisory; medium confidence): Flags comments on complex functions that do not explain why the shape exists. Accepted rationale vocabulary includes `because`, `why`, `intentional`, `tradeoff`/`trade-off`, `compat`/`compatible`/`compatibility`, `avoid`, and `preserve`, plus the phrases `due to`, `so that`, `in order to`, and `required by`. A contiguous run of leading `//` lines is evaluated as one comment; block comments are already evaluated as one body.
76
- - `docs.stale-comment` (advisory; medium confidence): Flags comments that reference missing files, unknown rules, stale CLI flags, or the wrong declaration.
77
- - `docs.stale-param-tag` (advisory; medium confidence): Flags @param tags for parameters no longer in the signature.
78
- - `docs.suppression-without-rationale` (advisory; medium confidence): Flags lint, formatter, coverage, or tool suppressions without a maintainer rationale.
79
- - `docs.todo-without-tracking` (advisory; high confidence): Flags comments introduced by a TODO, FIXME, HACK, or XXX marker without tracking context. The marker must start a comment body line (followed by `:`, `(`, `-`, whitespace, or end of line); quoted, backticked, mid-sentence, and fenced-example mentions are prose and stay quiet.
80
- - `docs.useless-docblock` (advisory; medium confidence): Flags comments or docblocks that only restate the symbol name.
135
+ - `docs.missing-return-tag` (advisory; medium confidence; options: everyCallable): Flags non-test documented callables without a described `@returns` tag, including `void`, `Promise<void>`, `asserts`, `never`, and `undefined` (excluding constructors and setters); with `everyCallable`, requires `/** ... */` JSDoc blocks across all non-test callables including slash- and block-commented helpers, skipping test files while keeping fixture directories checked.
136
+ - `docs.missing-side-effect-doc` (advisory; medium confidence): Flags commented functions that perform observable side effects without naming them. Off by default, because its keyword list cannot accept an accurate comment written in other words: enable it with `rules.docs.missing-side-effect-doc.enabled: true`.
137
+ - `docs.missing-why-for-complex-code` (advisory; low confidence): Flags comments on complex non-test functions that do not explain why the shape exists (`it`/`test` callbacks are skipped). Accepted rationale vocabulary includes `because`, `why`, `intentional`, `tradeoff`/`trade-off`, `compat`/`compatible`/`compatibility`, `avoid`, and `preserve`, plus the phrases `due to`, `so that`, `in order to`, and `required by`. A contiguous run of leading `//` lines is evaluated as one comment; block comments are already evaluated as one body.
138
+ - `docs.stale-param-tag` (advisory; medium confidence): Flags `@param` tags for parameters or destructured property keys no longer in the signature (accepting JSDoc object and matching dotted property tags for destructured parameters); with `everyCallable` on `docs.missing-param-tag`, covers all non-test documented callables.
139
+ - `docs.suppression-without-rationale` (advisory; low confidence): Flags lint, formatter, coverage, or tool suppressions without a maintainer rationale; the rationale may sit on the directive or in the comment lines directly above it.
140
+ - `docs.todo-without-tracking` (advisory; medium confidence): Flags comments introduced by a TODO, FIXME, HACK, or XXX marker without tracking context. The marker must start a comment body line (followed by `:`, `(`, `-`, whitespace, or end of line); quoted, backticked, mid-sentence, and fenced-example mentions are prose and stay quiet. A project's own tracking references count when they match a regular expression listed under `allowlists.trackingTokens`; gruff-ts ships no project-specific token.
81
141
 
82
142
  ## Maintainability
83
143
 
@@ -85,33 +145,22 @@ Rule IDs in this pillar keep the `waste.` prefix. The pillar was renamed from
85
145
  `waste` to `maintainability` in 0.1.1 and the IDs deliberately stayed put, so
86
146
  existing config overrides and baselines keep matching.
87
147
 
88
- - `waste.any-type` (warning; high confidence): Flags any type usage.
148
+ - `waste.any-type` (warning; medium confidence): Flags any type usage.
89
149
  - `waste.broad-runtime-version` (advisory; medium confidence): Flags broad runtime dependency version ranges.
90
- - `waste.commented-out-code` (advisory; high confidence): Flags comments that appear to contain disabled code.
91
- - `waste.console-log` (advisory; high confidence): Flags console log/debug calls in source.
92
- - `waste.empty-function` (advisory; high confidence): Flags functions with no executable body.
93
150
  - `waste.exported-any` (warning; medium confidence): Flags exported APIs exposing any.
94
- - `waste.redundant-boolean-cast` (advisory; medium confidence): Flags redundant boolean casts in condition expressions.
95
- - `waste.redundant-variable` (advisory; medium confidence): Flags variables returned immediately after assignment.
96
- - `waste.swallowed-catch` (warning; medium confidence): Flags empty catch blocks.
151
+ - `waste.swallowed-catch` (warning; medium confidence): Flags empty catch blocks with no comment that gives a reason. A comment of two or more words, a rationale or tracking reference (including a match for `allowlists.trackingTokens`), or an intent marker (`ignore`/`ignored`, `no-op`, `cleanup`, `teardown`, `best-effort`, `non-fatal`, `optional`) clears it; a one-word label such as `/* silent */`, or a comment holding `TODO`, `FIXME` or `XXX`, still reports. Off by default, because a measured sample stayed under the waste floor: enable it with `rules.waste.swallowed-catch.enabled: true`.
97
152
  - `waste.unreachable-code` (warning; high confidence): Flags statements after terminating statements.
98
- - `waste.unused-import` (advisory; medium confidence): Flags named imports with no apparent usage.
99
- - `waste.unused-parameter` (advisory; medium confidence): Flags parameters with no apparent usage.
153
+ - `waste.unused-import` (advisory; medium confidence): Flags named imports with no apparent usage, resolving inline `type` modifiers, aliases, and `$`-bearing identifiers through the TypeScript AST.
100
154
  - `waste.useless-catch` (advisory; high confidence): Flags catch blocks that only rethrow the caught value.
101
- - `waste.useless-return` (advisory; medium confidence): Flags terminal bare return statements in void functions.
155
+ - `waste.useless-return` (advisory; medium confidence): Flags terminal bare return statements in void functions. A bare `return;` that is the only statement of a `catch` block is not reported. Off by default since 0.6.0, because its 0.6.0 precision sample did not establish the floor: enable it with `rules.waste.useless-return.enabled: true`.
102
156
 
103
157
  ## Modernisation
104
158
 
105
159
  - `modernisation.date-now-candidate` (advisory; high confidence): Flags verbose current-time expressions that can use Date.now().
106
160
  - `modernisation.double-cast` (warning; medium confidence): Flags casts through unknown or any into another type.
107
- - `modernisation.loose-equality` (advisory; medium confidence): Flags loose equality comparisons that may coerce values.
108
161
  - `modernisation.non-null-assertion` (warning; medium confidence): Flags non-null assertions that bypass null checks.
109
- - `modernisation.nullish-coalescing-candidate` (advisory; medium confidence): Flags || fallbacks that may erase valid falsy values.
110
- - `modernisation.object-spread-candidate` (advisory; medium confidence): Flags Object.assign({}, ...) cloning that can use object spread.
111
- - `modernisation.optional-chaining-candidate` (advisory; medium confidence): Flags repeated guard-and-property access patterns.
112
- - `modernisation.public-property` (advisory; high confidence): Flags public class properties that expose representation.
113
- - `modernisation.readonly-property-candidate` (advisory; medium confidence): Flags class properties that appear readonly-worthy.
114
- - `modernisation.ts-comment-without-rationale` (warning; medium confidence): Flags TypeScript suppression comments without a rationale.
162
+ - `modernisation.readonly-property-candidate` (advisory; medium confidence): Flags private class fields their class assigns only in its own constructor, so marking them `readonly` compiles. Public and protected fields are not reported, because another file can write them. Nor is a field the class writes anywhere else, including another instance's field and a callback inside the constructor, any field of a class that writes through `this[...]` or `Object.assign(this, ...)`, or any field in a file that does not parse cleanly.
163
+ - `modernisation.ts-comment-without-rationale` (warning; medium confidence): Flags TypeScript suppression comments without a rationale; the rationale may follow the `@ts-` directive or sit in the `//` comment lines directly above it, and a match for `allowlists.trackingTokens` counts as one.
115
164
  - `modernisation.tsconfig-exact-optional-disabled` (warning; high confidence): Flags tsconfig files without exactOptionalPropertyTypes enabled.
116
165
  - `modernisation.tsconfig-index-safety-disabled` (warning; high confidence): Flags tsconfig files without noUncheckedIndexedAccess enabled.
117
166
  - `modernisation.tsconfig-strict-disabled` (warning; high confidence): Flags tsconfig files without strict mode enabled.
@@ -119,16 +168,9 @@ existing config overrides and baselines keep matching.
119
168
 
120
169
  ## Naming
121
170
 
122
- - `naming.acronym-case` (advisory; medium confidence): Flags a known acronym cased inconsistently across a file's chosen-case names (camelCase/PascalCase and other mixed-case forms). SCREAMING_SNAKE constants and all-lower names are convention-forced surfaces and do not count.
123
- - `naming.boolean-prefix` (advisory; medium confidence; allowlists: booleanPrefixes, acceptedBooleanNames): Flags boolean names without intent-revealing prefixes on declarations, function parameters (typed `: boolean` or with `= true|false` default), and interface/type-literal fields. Local and parameter findings recommend a safe rename (`remediationAction: APPLY`). Contract-field findings use `CONFIGURE` with `configurationKey: allowlists.acceptedBooleanNames` and explain that users may instead preserve an external key through explicit serialization mapping; configuration replaces the complete accepted-name list rather than merging one entry into the defaults.
124
171
  - `naming.class-file-mismatch` (advisory; medium confidence; allowlist: acceptedClassFilePairs): Flags a named class whose normalized name differs from the file only when it is the module's sole supported public declaration. Direct exports, named default exports, and bottom re-exports share one syntax inventory; a public class beside an interface, type, enum, function, default value, or external re-export stays quiet. Exact case-insensitive `fileBase:ClassName` entries preserve intentional feature-file/class-role conventions. Retained findings include `candidatePrimaryExport: true` and sorted `publicExports` metadata.
125
- - `naming.generic-function` (advisory; high confidence): Flags generic function names that hide intent.
126
- - `naming.generic-parameter` (advisory; medium confidence; options: minCyclomatic, minLineCount, minParameters): Flags placeholder parameter names in multi-parameter, long, exported, or complex functions.
127
- - `naming.hungarian-notation` (advisory; medium confidence): Flags identifiers named after storage type prefixes.
128
- - `naming.identifier-quality` (advisory; medium confidence): Flags placeholder or numbered identifiers on declarations, function parameters, and destructured locals.
129
- - `naming.inconsistent-casing` (advisory; medium confidence; allowlist: acceptedCasingPairs): Flags one canonical identifier appearing in different forms within the same module, function, interface, or named type-literal owner. Separate raw DTO and normalized UI model contracts may keep their own conventions; same-name interface declaration blocks in one lexical scope are treated as one merged owner. Exact case-insensitive pairs such as `note_id:noteId` preserve documented wire aliases inside one owner without hiding other variants.
130
- - `naming.negative-boolean` (advisory; medium confidence): Flags boolean identifiers framed as a negation on declarations, parameters, and interface fields.
131
- - `naming.short-variable` (advisory; medium confidence): Flags very short variable names outside common loop counters; covers declarations, function parameters, and destructured locals.
172
+ - `naming.identifier-quality` (advisory; low confidence): Flags placeholder or numbered identifiers on declarations, function parameters, and destructured locals.
173
+ - `naming.short-variable` (advisory; medium confidence): Flags very short variable names outside common loop counters; covers declarations, function parameters, and destructured locals, while exempting `t` when typed as `TestContext` or inside test files.
132
174
 
133
175
  ## Security
134
176
 
@@ -136,66 +178,52 @@ existing config overrides and baselines keep matching.
136
178
  - `security.disabled-tls-verification` (error; high confidence): Flags code that disables TLS certificate verification.
137
179
  - `security.document-write` (warning; high confidence): Flags document.write usage.
138
180
  - `security.dynamic-regexp` (warning; medium confidence): Flags external input used to construct regular expressions.
139
- - `security.eval-call` (error; high confidence): Flags eval() dynamic code execution.
140
- - `security.floating-promise` (warning; medium confidence): Flags promise-like calls without await, return, or void.
141
- - `security.github-actions-broad-permissions` (warning; medium confidence): Flags GitHub Actions workflows that grant broad write permissions.
181
+ - `security.eval-call` (error; high confidence): Flags eval() dynamic code execution. An `eval` whose only argument is one fixed string or a template without `${}` is not reported, unless another `eval` on the same line takes other input.
142
182
  - `security.github-actions-pull-request-target` (warning; medium confidence): Flags pull_request_target workflows paired with risky execution or trust context.
143
183
  - `security.github-actions-remote-shell` (warning; medium confidence): Flags workflow run steps that pipe remote downloads to a shell.
144
- - `security.github-actions-secrets-in-pr` (warning; medium confidence): Flags pull request workflows that reference GitHub secrets.
184
+ - `security.github-actions-secrets-in-pr` (warning; medium confidence): Flags pull_request_target workflows that reference repository secrets other than GITHUB_TOKEN. The trigger is read from the workflow's `on:` key; a plain `pull_request` run from a fork receives no secrets. An own job or step `if:` guard can silence a secret reference when exact `github.event_name` comparisons prove that scope unreachable for the detected PR event. Comparisons ignore case and support a whole expression wrapper, parentheses, negation, AND and OR. Unknown, malformed or unsupported guards and ambiguous YAML ownership retain warnings; a step guard cannot cover job/workflow env or siblings.
145
185
  - `security.github-actions-unpinned-action` (warning; medium confidence): Flags third-party GitHub Actions that are not pinned to a full commit SHA.
146
- - `security.inner-html` (warning; high confidence): Flags innerHTML assignment.
147
- - `security.insecure-random` (warning; high confidence): Flags Math.random usage in source.
148
- - `security.javascript-url` (error; high confidence): Flags javascript: URL literals that execute script.
186
+ - `security.inner-html` (warning; high confidence): Flags innerHTML assignment unless the value is a plain string or a template without substitutions. Off by default since 0.6.0, because its 0.6.0 precision sample did not establish the floor: enable it with `rules.security.inner-html.enabled: true`.
187
+ - `security.javascript-url` (error; high confidence): Flags javascript: URL literals that execute script; a literal compared with ==, ===, != or !== stays quiet.
149
188
  - `security.new-function` (error; high confidence): Flags Function constructor dynamic code execution.
150
- - `security.open-redirect-candidate` (warning; medium confidence): Flags external input sent to redirect or navigation sinks.
151
- - `security.path-traversal-candidate` (warning; medium confidence): Flags external input sent to filesystem path sinks.
152
- - `security.process-exec` (warning; high confidence): Flags child-process execution calls, grading severity from command-source and shell-mode evidence: warning only when a shell-enabled call takes a dynamic command.
153
- - `security.proto-access` (warning; medium confidence): Flags direct __proto__ access that can enable prototype pollution.
189
+ - `security.open-redirect-candidate` (warning; medium confidence): Flags external input sent to redirect or navigation sinks. Off by default (ADR-021): enable it with `rules.security.open-redirect-candidate.enabled: true`.
190
+ - `security.path-traversal-candidate` (warning; medium confidence): Flags external input sent to filesystem path sinks. Off by default since 0.6.0, because its 0.6.0 precision sample did not establish the floor: enable it with `rules.security.path-traversal-candidate.enabled: true`.
154
191
  - `security.remote-install-script` (error; medium confidence): Flags package scripts that pipe remote content to a shell.
155
- - `security.risky-lifecycle-script` (warning; medium confidence): Flags install-time and side-effectful publish lifecycle scripts while allowing validation-only publish gates.
156
- - `security.sql-concatenation` (warning; high confidence): Flags SQL text composed with runtime interpolation or concatenation in `query`, `execute`, `raw`, or `prepare` calls. Parameterized value placeholders stay quiet, but unknown runtime identifier interpolation such as table prefixes remains visible unless a project proves and documents a trusted source. The scanner is line-local and does not inspect multi-line SQL templates.
192
+ - `security.sql-concatenation` (warning; low confidence): Flags SQL text composed with runtime interpolation or concatenation in `query`, `execute`, `raw`, or `prepare` calls. Parameterized value placeholders stay quiet, but unknown runtime identifier interpolation such as table prefixes remains visible unless a project proves and documents a trusted source. The scanner is line-local and does not inspect multi-line SQL templates.
157
193
  - `security.ssrf-candidate` (warning; medium confidence): Flags external input sent to network request sinks.
158
194
  - `security.string-timer` (warning; high confidence): Flags string callbacks passed to timers.
159
195
  - `security.throw-non-error` (warning; medium confidence): Flags thrown non-Error values.
160
- - `security.unsafe-deserialization` (warning; medium confidence): Flags external input reaching unsafe deserialization or dynamic code-loading sinks.
196
+ - `security.unsafe-deserialization` (warning; medium confidence): Flags external input reaching unsafe deserialization or dynamic code-loading sinks. Bytes read by an imported, unshadowed Node `fs` call are not external input even when the input chose the file name. Off by default since 0.6.0, because no finding survived its 0.6.0 repair to measure: enable it with `rules.security.unsafe-deserialization.enabled: true`.
161
197
  - `security.url-dependency` (warning; medium confidence): Flags dependencies installed from URL, git, or local file specs.
162
- - `security.weak-crypto` (warning; high confidence): Flags weak crypto primitives such as md5, sha1, or createCipher.
198
+ - `security.weak-crypto` (warning; high confidence): Flags weak crypto primitives such as md5, sha1, or createCipher. An HMAC built on SHA-1, `createHmac("sha1", ...)`, is not reported; an MD5 HMAC and MD5 or SHA-1 hashes still are.
163
199
  - `security.xxe-candidate` (warning; medium confidence): Flags external XML reaching parsers configured to expand entities.
164
200
 
165
201
  ## Sensitive Data
166
202
 
167
- Pattern detectors (AWS keys, API keys, credential URLs, JWTs) skip values carrying explicit fake markers inside the matched value itself (`EXAMPLE`, `REDACTED`, `PLACEHOLDER`, `CHANGEME`, or masked `****`/`XXXX` runs) - the canonical AWS documentation keys end in `EXAMPLE`. A test or fixture file path alone never suppresses a production-shaped secret.
203
+ Every sensitive-data rule skips test, fixture, and example paths (`test`, `tests`, `__tests__`, `spec`, `testdata`, `fixtures`, `examples`, and test-named files such as `*.test.*` and `*.spec.*`) and records each skip as a counted `source: "built-in"` audit row. Pattern detectors also skip 20 vendor-documented sample values (AWS example keys, the jwt.io sample token, Google's reCAPTCHA v2 test site key, and 14 test card numbers), stock local development database credentials on loopback or single-label hosts, and values carrying explicit fake markers (`EXAMPLE`, `REDACTED`, `PLACEHOLDER`, `CHANGEME`, or masked `****`/`XXXX` runs; AWS keys treat only a full 16-`X` body as masked).
168
204
 
169
- - `sensitive-data.api-key-pattern` (error; high confidence): Flags vendor API key patterns including GitHub, GitLab, npm, Google API, Slack, Discord, and Stripe/OpenAI-style keys.
170
- - `sensitive-data.aws-access-key` (error; high confidence): Flags AWS access key looking values.
171
- - `sensitive-data.database-url-password` (error; high confidence): Flags database and HTTP(S) URLs that include passwords or embedded credentials.
172
- - `sensitive-data.gcp-service-account-key` (error; high confidence): Flags GCP service-account key files (type service_account alongside a private key).
173
- - `sensitive-data.hardcoded-env-value` (error; medium confidence; threshold 16): Flags environment-style secret values committed in text. In script files (TS/JS) only quoted values count: an unquoted right-hand side is a code expression (schema builder, secret-provider plumbing), not an embedded literal.
174
- - `sensitive-data.high-entropy-string` (error; medium confidence; threshold 32): Flags high-entropy string literals that may be secrets. Identifier-shaped values that decompose entirely into short dictionary-like word segments (dotted namespaces such as `Com.Example2.Services.TokenProvider`, underscored constants, slug-like catalog names) are exempt because credential alphabets interleave case and digits rather than forming words; JWTs and 20+ char mixed-case segments never earn the exemption. Character-set enumerations (a 10+ run of consecutive code points, e.g. base64 translation alphabets) are also exempt.
175
- - `sensitive-data.jwt-token` (error; high confidence): Flags JWT-looking token literals.
176
- - `sensitive-data.phi-pattern` (error; high confidence): Flags PHI identifiers such as Medicare (MBI) and medical record numbers.
177
- - `sensitive-data.pii-pattern` (error; high confidence): Flags PII-like identifier patterns including SSN-shaped values and Luhn-valid payment cards. A bare unseparated digit run additionally needs card vocabulary on its line (statistics can pass Luhn by coincidence); separator-grouped numbers flag without context.
178
- - `sensitive-data.private-key` (error; high confidence): Flags private key block markers.
205
+ - `sensitive-data.api-key-pattern` (warning; high confidence): Flags vendor API key patterns including GitHub, GitLab, npm, Google API, Slack, Discord, and Stripe/OpenAI-style keys.
206
+ - `sensitive-data.aws-access-key` (warning; high confidence): Flags AWS access key looking values. Off by default since 0.6.0, because its 0.6.0 precision sample did not establish the floor: enable it with `rules.sensitive-data.aws-access-key.enabled: true`.
207
+ - `sensitive-data.database-url-password` (warning; high confidence): Flags database and HTTP(S) URLs that include passwords or embedded credentials. Off by default since 0.6.0, because its 0.6.0 precision sample did not establish the floor: enable it with `rules.sensitive-data.database-url-password.enabled: true`.
208
+ - `sensitive-data.gcp-service-account-key` (warning; high confidence): Flags GCP service-account key files (type service_account alongside a private key).
209
+ - `sensitive-data.jwt-token` (warning; high confidence): Flags JWT-looking token literals. Off by default (ADR-021): enable it with `rules.sensitive-data.jwt-token.enabled: true`.
210
+ - `sensitive-data.phi-pattern` (warning; high confidence): Flags PHI identifiers such as Medicare (MBI) and medical record numbers.
211
+ - `sensitive-data.pii-pattern` (warning; high confidence): Flags PII-like identifier patterns including SSN-shaped values and Luhn-valid payment cards. A bare unseparated digit run additionally needs card vocabulary on its line (statistics can pass Luhn by coincidence); separator-grouped numbers flag without context.
212
+ - `sensitive-data.private-key` (warning; high confidence): Flags private key block markers.
179
213
 
180
214
  ## Size
181
215
 
182
- - `size.file-length` (error; high confidence; threshold 1000): Flags files with more than 1000 substantive lines by default. Blank lines and comment-only lines (`//`, `/* */`, XML comments, and the leading comment markers used by supported YAML/TOML/env/INI/npmrc files) do not count; lines containing code or data still count. `metadata.lines` is the substantive count.
183
- - `size.function-length` (warning; high confidence; threshold 200): Flags functions longer than the configured threshold.
184
- - `size.parameter-count` (warning; high confidence; threshold 7): Flags functions with too many parameters.
216
+ - `size.file-length` (error; high confidence; threshold 1000): Flags JavaScript and TypeScript files with more than 1000 substantive lines by default; JSON, YAML, TOML, XML and other data files are not measured. Blank lines, comment-only lines (`//`, `/* */`), a `#!` interpreter line and lines that hold only a TypeScript decorator do not count; lines containing other code still count. `metadata.lines` is the substantive count.
217
+ - `size.function-length` (warning; high confidence; threshold 200): Flags functions longer than the configured threshold, counted in code lines: blank, comment-only and decorator-only lines do not count.
218
+ - `size.parameter-count` (warning; medium confidence; threshold 7): Flags functions with too many parameters.
185
219
 
186
220
  ## Test Quality
187
221
 
188
- - `test-quality.conditional-logic` (advisory; high confidence): Flags tests with conditional logic.
189
- - `test-quality.exception-type-only` (advisory; high confidence): Flags tests that only assert exception type.
222
+ - `test-quality.duplicate-test-body` (advisory; low confidence; default-on): Flags groups of three or more tests in one container whose normalized bodies match and have at least three statements, recommending labelled table-driven rows (disable with `rules.test-quality.duplicate-test-body.enabled: false`). Identifiers, operations, modifier/options values, whitespace-bearing strings, key/index literals, decorator arguments, and nested type/function/class declarations stay exact while `const` bindings normalize; separate suites, shorter bodies, pairs, and existing table tests stay quiet. Review each member before consolidating.
190
223
  - `test-quality.global-state-mutation` (warning; high confidence): Flags tests mutating process or global runtime state.
191
224
  - `test-quality.loop-in-test` (advisory; medium confidence): Flags test-body loops whose assertions do not identify the failing iteration.
192
- - `test-quality.magic-number-assertion` (advisory; medium confidence): Flags assertions against unexplained numeric literals.
193
- - `test-quality.mock-only-test` (advisory; high confidence): Flags tests that only verify mock interaction.
194
- - `test-quality.no-assertions` (warning; high confidence): Flags tests without apparent assertions.
195
- - `test-quality.no-throw-only-test` (advisory; high confidence): Flags tests that only assert code does not throw.
196
- - `test-quality.only-skip` (advisory; high confidence): Flags focused or skipped test markers.
197
- - `test-quality.sleep-in-test` (advisory; high confidence): Flags sleeps in tests.
198
- - `test-quality.snapshot-only-test` (advisory; high confidence): Flags tests that rely only on snapshots.
199
225
  - `test-quality.static-analysis-redundant-test` (advisory; high confidence): Flags tests that primarily assert code shape rather than behavior, with review guidance for importability sentinels.
200
226
  - `test-quality.trivial-assertion` (warning; high confidence): Flags tautological assertions.
201
227
  - `test-quality.unused-mock` (advisory; medium confidence): Flags mocks created but not used.
228
+
229
+ Loop assertions identify a failing iteration either through a message referencing the loop binding or by asserting directly against that binding (including `for...of`, `for...in`, and C-style loops).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blundergoat/gruff-ts",
3
- "version": "0.5.0",
4
- "description": "Governs AI-generated code so a human can verify it: a TypeScript/JavaScript static analyzer - 120 rules across 11 quality pillars, SARIF output, baselines, and a local dashboard.",
3
+ "version": "0.6.0",
4
+ "description": "Governs AI-generated code so a human can verify it: a TypeScript/JavaScript static analyzer - 81 rules across 11 quality pillars, SARIF output, baselines, and a local dashboard.",
5
5
  "license": "MIT",
6
6
  "author": "Matthew Hansen (https://www.blundergoat.com/about)",
7
7
  "homepage": "https://github.com/blundergoat/gruff-ts#readme",
@@ -33,13 +33,14 @@
33
33
  "nodejs"
34
34
  ],
35
35
  "engines": {
36
- "node": ">=22"
36
+ "node": ">=22.12.0"
37
37
  },
38
38
  "type": "module",
39
39
  "files": [
40
40
  "bin/",
41
41
  "src/",
42
42
  "!src/**/*.test.ts",
43
+ "!src/test-fixtures.ts",
43
44
  "!src/fixtures/",
44
45
  "docs/",
45
46
  "!docs/releasing.md",
@@ -48,6 +49,7 @@
48
49
  "README.md",
49
50
  "LICENSE",
50
51
  "CHANGELOG.md",
52
+ "UPGRADING.md",
51
53
  "CONTRIBUTING.md",
52
54
  "SECURITY.md"
53
55
  ],
@@ -60,12 +62,12 @@
60
62
  "start-dev": "tsx src/cli.ts dashboard"
61
63
  },
62
64
  "dependencies": {
63
- "commander": "^14.0.2",
64
- "tsx": "^4.21.0",
65
- "typescript": "^5.9.3"
65
+ "commander": "^15.1.0",
66
+ "tsx": "^4.23.15",
67
+ "typescript": "^6.0.3"
66
68
  },
67
69
  "devDependencies": {
68
- "@blundergoat/goat-flow": "^1.6.4",
69
- "@types/node": "^25.0.0"
70
+ "@blundergoat/goat-flow": "^1.19.0",
71
+ "@types/node": "^22.20.7"
70
72
  }
71
73
  }