checkchange 0.5.7 → 0.5.8
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.
- package/.agents/skills/using-checkchange/SKILL.md +1 -0
- package/dist/complexity-providers/csharpDescriptorProvider.js +2 -2
- package/dist/crapCalc.d.ts +1 -1
- package/dist/crapCalc.js +2 -3
- package/dist/evidence.d.ts +1 -1
- package/dist/evidence.js +2 -2
- package/dist/formatters/github.js +3 -1
- package/dist/formatters/junit.js +1 -1
- package/dist/formatters/sarif.js +17 -0
- package/dist/rules.d.ts +1 -1
- package/dist/rules.js +1 -1
- package/package.json +1 -1
|
@@ -59,6 +59,7 @@ Correct use of `checkchange check`: prevents hallucination, enforces WARN blocks
|
|
|
59
59
|
- CRAP: = CC + uncovered lines; 0% coverage → high CRAP.
|
|
60
60
|
- Cache: `--cache` opt-in (default off). Also `CHECKCHANGE_CACHE=1` env.
|
|
61
61
|
- Format: `--format github|junit|sarif` (sidecar, separate from --json). Valid only on `check`. SARIF sidecar emits canonical `$schema` key (`https://json.schemastore.org/sarif-2.1.0.json`) since 0.5.1 — strict SARIF validators accept it.
|
|
62
|
+
- Sidecar NOT_EVALUATED (since 0.5.8): functions the gate cannot evaluate (no coverage) are reported honestly — github annotation title `CRAP not evaluated`, message `CRAP n/a (coverage unavailable, cc N)` (no more `CRAP null > 30`); SARIF emits a `level:'note'` result per such function (WARN results unchanged; notes excluded from the gate); JUnit `<skipped message="...">` carries the reason. Gate verdict, exit codes, and `--json` evidence unchanged.
|
|
62
63
|
- Value flags: inline (`--base=HEAD`) and next-token (`--base HEAD`) both honored; bare or empty-inline (`--base`, `--base=`) errors `<flag> requires a value`; `--crap-threshold abc` errors instead of producing NaN.
|
|
63
64
|
- Bun projects: `bun test --coverage --coverage-reporter=lcov` then `checkchange check --coverage-file coverage/lcov.info --json`. lcov provider reads `DA:` line-hit records, ignores `FN:` (bun emits none).
|
|
64
65
|
- Gate self-disable trap: a diff containing unsupported-extension files (e.g. package-lock.json, reformatted package.json) can make checkchange evaluate 0 functions → gate NOT_EVALUATED with gateReason no-supported-file-extensions. Keep such files out of the diff.
|
|
@@ -174,10 +174,10 @@ export function vehicleRejection() {
|
|
|
174
174
|
return lastVehicleRejection;
|
|
175
175
|
}
|
|
176
176
|
// The fallback parser is checkchange's OWN code (./csharpFallbackParser.ts), so
|
|
177
|
-
// its tool is checkchange and its version is the package version — same 0.5.
|
|
177
|
+
// its tool is checkchange and its version is the package version — same 0.5.8
|
|
178
178
|
// the other self-provenance consts hard-code (src/crapCalc.ts:3, src/rules.ts:4).
|
|
179
179
|
const FALLBACK_TOOL = 'checkchange';
|
|
180
|
-
const FALLBACK_TOOL_VERSION = '0.5.
|
|
180
|
+
const FALLBACK_TOOL_VERSION = '0.5.8';
|
|
181
181
|
// The vehicle's INSTALLED version is never probed: the rich path is
|
|
182
182
|
// documented-unreachable (see SPAWN FORM above), so `dotnet-crap --version` is
|
|
183
183
|
// never spawned to learn it, and no version is fabricated here. `unknown` is the
|
package/dist/crapCalc.d.ts
CHANGED
package/dist/crapCalc.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// Provenance for the crapCalc lineage stage. Self tool version tracks package.json
|
|
2
|
-
|
|
3
|
-
export const crapCalcProvenance = { tool: 'checkchange', version: '0.5.7' };
|
|
1
|
+
// Provenance for the crapCalc lineage stage. Self tool version tracks package.json.
|
|
2
|
+
export const crapCalcProvenance = { tool: 'checkchange', version: '0.5.8' };
|
|
4
3
|
export function calculateCrap(cc, coveragePercent) {
|
|
5
4
|
if (coveragePercent == null) {
|
|
6
5
|
return null;
|
package/dist/evidence.d.ts
CHANGED
package/dist/evidence.js
CHANGED
|
@@ -20,8 +20,8 @@ import * as path from 'path';
|
|
|
20
20
|
import { loadProviderConfig, deriveRegistry, builtinConfig, createGenericCommandProvider } from './providers/index.js';
|
|
21
21
|
import { filterDiffedFiles } from './generated-filter.js';
|
|
22
22
|
const requireFromEvidence = createRequire(import.meta.url);
|
|
23
|
-
// Self provenance; version mirrors package.json
|
|
24
|
-
export const evidenceProvenance = { tool: 'checkchange', version: '0.5.
|
|
23
|
+
// Self provenance; version mirrors package.json.
|
|
24
|
+
export const evidenceProvenance = { tool: 'checkchange', version: '0.5.8' };
|
|
25
25
|
function sha256Hex(content) {
|
|
26
26
|
return createHash('sha256').update(content).digest('hex');
|
|
27
27
|
}
|
|
@@ -21,7 +21,9 @@ export function formatGitHub(out, opts) {
|
|
|
21
21
|
const annotations = out.ruleResults
|
|
22
22
|
.map((r, i) => ({ r, fn: out.changedFunctions[i] }))
|
|
23
23
|
.filter(({ r }) => r.result === 'WARN' || r.result === 'NOT_EVALUATED')
|
|
24
|
-
.map(({ r, fn }) =>
|
|
24
|
+
.map(({ r, fn }) => r.result === 'WARN'
|
|
25
|
+
? `::warning file=${r.file},line=${fn.lineStart},endLine=${fn.lineEnd},title=high CRAP:: ${r.method} CRAP ${r.crap} > ${r.threshold} (cc ${r.cc}, cov ${r.coverage})`
|
|
26
|
+
: `::warning file=${r.file},line=${fn.lineStart},endLine=${fn.lineEnd},title=CRAP not evaluated:: ${r.method} CRAP n/a (coverage unavailable, cc ${r.cc})`)
|
|
25
27
|
.join('\n');
|
|
26
28
|
return [annotations, prTable(out)].filter(Boolean).join('\n\n---\n\n');
|
|
27
29
|
}
|
package/dist/formatters/junit.js
CHANGED
|
@@ -20,7 +20,7 @@ export function formatJUnit(out, opts) {
|
|
|
20
20
|
return ` <testcase ${attrs}>\n <failure message="${escapeXml(message)}">${escapeXml(r.method)} ${escapeXml(message)}</failure>\n </testcase>`;
|
|
21
21
|
}
|
|
22
22
|
if (r.result === 'NOT_EVALUATED') {
|
|
23
|
-
return ` <testcase ${attrs}>\n <skipped/>\n </testcase>`;
|
|
23
|
+
return ` <testcase ${attrs}>\n <skipped message="${escapeXml(`CRAP not evaluated (coverage unavailable, cc ${r.cc})`)}"/>\n </testcase>`;
|
|
24
24
|
}
|
|
25
25
|
return ` <testcase ${attrs}/>`;
|
|
26
26
|
})
|
package/dist/formatters/sarif.js
CHANGED
|
@@ -17,10 +17,27 @@ export function formatSARIF(out, opts) {
|
|
|
17
17
|
],
|
|
18
18
|
message: { text: `${r.method} CRAP ${r.crap} > ${r.threshold} (cc ${r.cc}, cov ${r.coverage})` },
|
|
19
19
|
}));
|
|
20
|
+
const notEvaluatedResults = out.ruleResults
|
|
21
|
+
.map((r, i) => ({ r, fn: out.changedFunctions[i] }))
|
|
22
|
+
.filter(({ r }) => r.result === 'NOT_EVALUATED')
|
|
23
|
+
.map(({ r, fn }) => ({
|
|
24
|
+
ruleId: 'changed-function-high-crap',
|
|
25
|
+
level: 'note',
|
|
26
|
+
locations: [
|
|
27
|
+
{
|
|
28
|
+
physicalLocation: {
|
|
29
|
+
artifactLocation: { uri: r.file },
|
|
30
|
+
region: { startLine: fn.lineStart, endLine: fn.lineEnd },
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
message: { text: `${r.method} CRAP not evaluated (coverage unavailable, cc ${r.cc})` },
|
|
35
|
+
}));
|
|
20
36
|
// FN/FNDA: informational note results when diagnostics carry function coverage.
|
|
21
37
|
const coverageEntries = out.diagnostics?.functionCoverage ?? [];
|
|
22
38
|
const results = [
|
|
23
39
|
...warnResults,
|
|
40
|
+
...notEvaluatedResults,
|
|
24
41
|
...coverageEntries.map((entry) => ({
|
|
25
42
|
ruleId: 'function-hit-coverage',
|
|
26
43
|
level: 'note',
|
package/dist/rules.d.ts
CHANGED
package/dist/rules.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Provenance for the rules lineage stage. Self tool version tracks package.json.
|
|
2
|
-
export const rulesProvenance = { tool: 'checkchange', version: '0.5.
|
|
2
|
+
export const rulesProvenance = { tool: 'checkchange', version: '0.5.8' };
|
|
3
3
|
/**
|
|
4
4
|
* Evaluate changed functions against the high-CRAP rule.
|
|
5
5
|
* @param changed Array of changed functions
|