@hublo/sentinel 1.5.0-alpha.20 → 1.5.0-alpha.21
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/dist/bin/sentinel.js
CHANGED
|
@@ -5433,10 +5433,10 @@ var metricsHelp = {
|
|
|
5433
5433
|
},
|
|
5434
5434
|
unusedFiles: {
|
|
5435
5435
|
label: "Unreachable files",
|
|
5436
|
-
what: "Files
|
|
5437
|
-
read: "
|
|
5438
|
-
caveat: "
|
|
5439
|
-
source: "jscpd dead-code
|
|
5436
|
+
what: "Files of this module that nothing reaches: not its own code, not another module, not a spec.",
|
|
5437
|
+
read: "A candidate for deletion, and the only one of the dead-code rows that names whole files. Zero is the ordinary value for an application whose entry points are declared.",
|
|
5438
|
+
caveat: "\u26A0\uFE0F Two classes remain in it and only one is a deletion: a file nothing reaches at all, and an entry point of a framework this role has not been told about, which is a missing declaration rather than dead code. A THIRD class used to sit here and no longer does: a file reached only by a spec, which the tool labels `used-only-by-tests` itself, is now counted on its own row instead. Measured on `libs/nest/auth`, that moved 5 files out of 20, and the figure now agrees with the reason printed beside each finding instead of contradicting it.",
|
|
5439
|
+
source: "jscpd's dead-code walk, category `unused-file`, minus the findings it labels `used-only-by-tests`. The walk starts from the module's declared entry points PLUS the files another module imports, which come from the workspace index: without those seeds a library has no starting point at all and reports 87 unreachable files where 12 are, measured on `libs/nest/auth`."
|
|
5440
5440
|
},
|
|
5441
5441
|
unusedExports: {
|
|
5442
5442
|
label: "Unused exports",
|
|
@@ -6701,6 +6701,11 @@ function assembleReport(ctx, config, product, tests, dead, complexity, graph, co
|
|
|
6701
6701
|
if (unreadable) {
|
|
6702
6702
|
notes.push(unreadableNote(coverage));
|
|
6703
6703
|
}
|
|
6704
|
+
const toolTestOnly = new Set(
|
|
6705
|
+
dead.kind === "figures" ? dead.findings.filter(
|
|
6706
|
+
(finding) => finding.category === "unused-file" && finding.reasons?.includes("used-only-by-tests") === true
|
|
6707
|
+
).map((finding) => finding.path ?? "").filter(Boolean) : []
|
|
6708
|
+
);
|
|
6704
6709
|
if (dead.kind === "figures" && !unreadable) {
|
|
6705
6710
|
const stats = dead.statistics;
|
|
6706
6711
|
rows.push(
|
|
@@ -6710,14 +6715,23 @@ function assembleReport(ctx, config, product, tests, dead, complexity, graph, co
|
|
|
6710
6715
|
unit: `of ${stats.files ?? 0} files`
|
|
6711
6716
|
},
|
|
6712
6717
|
{ metric: "deadLinesPercent", value: share(stats), unit: "%" },
|
|
6713
|
-
|
|
6718
|
+
// ⛔ Minus the files the TOOL itself labels `used-only-by-tests`. They were counted as
|
|
6719
|
+
// unreachable while the tool knew better: measured on `libs/nest/auth`, 5 of the 20. A file a
|
|
6720
|
+
// spec reaches is not unreachable, and leaving it in the headline count meant the figure
|
|
6721
|
+
// disagreed with the reason printed beside it.
|
|
6722
|
+
{
|
|
6723
|
+
metric: "unusedFiles",
|
|
6724
|
+
value: Math.max((dead.byCategory["unused-file"] ?? 0) - toolTestOnly.size, 0),
|
|
6725
|
+
unit: "files"
|
|
6726
|
+
},
|
|
6714
6727
|
{ metric: "unusedExports", value: dead.byCategory["unused-export"] ?? 0, unit: "exports" },
|
|
6715
6728
|
{ metric: "unusedSymbols", value: dead.byCategory["unused-symbol"] ?? 0, unit: "symbols" },
|
|
6716
6729
|
{ metric: "unusedImports", value: dead.byCategory["unused-import"] ?? 0, unit: "imports" }
|
|
6717
6730
|
);
|
|
6718
6731
|
}
|
|
6719
|
-
|
|
6720
|
-
|
|
6732
|
+
const testOnly = /* @__PURE__ */ new Set([...toolTestOnly, ...outside.testOnly]);
|
|
6733
|
+
if (testOnly.size > 0 && !unreadable) {
|
|
6734
|
+
rows.push({ metric: "usedOnlyByTests", value: testOnly.size, unit: "files" });
|
|
6721
6735
|
}
|
|
6722
6736
|
if (complexity.functions > 0) {
|
|
6723
6737
|
rows.push({ metric: "complexityMax", value: complexity.max, unit: "max per function" });
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hublo/sentinel",
|
|
3
|
-
"version": "1.5.0-alpha.
|
|
3
|
+
"version": "1.5.0-alpha.21",
|
|
4
4
|
"description": "One CLI that guards code health across Hublo repos: shared lint/typescript/build/test presets, static & dynamic analysis, and architecture checks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|