stopslop 0.1.1 → 0.1.2
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/README.md +4 -2
- package/dist/cli.js +7 -0
- package/dist/index.d.ts +5 -6
- package/dist/src.js +0 -0
- package/package.json +2 -2
- package/schema.json +16 -0
package/README.md
CHANGED
|
@@ -159,6 +159,9 @@ stopslop [path] analyze a directory or file (default: .)
|
|
|
159
159
|
|
|
160
160
|
Exit codes: `0` clean · `1` findings · `2` error.
|
|
161
161
|
|
|
162
|
+
Invalid configuration, zero supported source files, and hard analysis errors
|
|
163
|
+
exit `2` before StopSlop emits a report, badge, or baseline.
|
|
164
|
+
|
|
162
165
|
### For an agent loop
|
|
163
166
|
|
|
164
167
|
```bash
|
|
@@ -304,8 +307,7 @@ top-level `entry` and `project` when multiple workspaces are present.
|
|
|
304
307
|
|
|
305
308
|
**Full reference with every field, defaults, and examples:
|
|
306
309
|
[docs/configuration.md](docs/configuration.md).** Defaults are calibrated on a
|
|
307
|
-
22-repo TypeScript corpus ([docs/thresholds.md](docs/thresholds.md))
|
|
308
|
-
*preliminary* in output until validated further.
|
|
310
|
+
22-repo TypeScript corpus ([docs/thresholds.md](docs/thresholds.md)).
|
|
309
311
|
|
|
310
312
|
## How it works & why the numbers
|
|
311
313
|
|
package/dist/cli.js
CHANGED
|
@@ -310,6 +310,12 @@ function toBadge(result) {
|
|
|
310
310
|
return `${JSON.stringify(payload, null, 2)}\n`;
|
|
311
311
|
}
|
|
312
312
|
//#endregion
|
|
313
|
+
//#region src/analysis-completeness.ts
|
|
314
|
+
function assertAnalysisComplete(result) {
|
|
315
|
+
if (result.fileCount === 0) throw new Error("analysis incomplete: no supported source files found");
|
|
316
|
+
if (result.errors.length > 0) throw new Error(`analysis incomplete: ${result.errors.join("; ")}`);
|
|
317
|
+
}
|
|
318
|
+
//#endregion
|
|
313
319
|
//#region src/cli.ts
|
|
314
320
|
function parseArgs(argv) {
|
|
315
321
|
const args = {
|
|
@@ -389,6 +395,7 @@ async function main() {
|
|
|
389
395
|
config.deadCode.enabled = false;
|
|
390
396
|
}
|
|
391
397
|
const result = args.base ? await analyzeGitBase(args.path, args.base, config) : await analyze(args.path, config);
|
|
398
|
+
assertAnalysisComplete(result);
|
|
392
399
|
if (args.updateBaseline) {
|
|
393
400
|
writeBaseline(args.baseline, result.findings);
|
|
394
401
|
process.stderr.write(`stopslop: baseline written to ${args.baseline} (${result.findings.length} findings accepted)\n`);
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ interface Finding {
|
|
|
13
13
|
message: string;
|
|
14
14
|
/** Structured payload for --json consumers and --details rendering. */
|
|
15
15
|
data?: Record<string, unknown>;
|
|
16
|
-
/**
|
|
16
|
+
/** Compatibility marker for reports produced with provisional thresholds. */
|
|
17
17
|
preliminary?: boolean;
|
|
18
18
|
}
|
|
19
19
|
/** A parsed source file with everything analyzers need, produced once per file. */
|
|
@@ -145,7 +145,7 @@ interface ResolvedConfig {
|
|
|
145
145
|
/** fan-in fraction above which a member is treated as a hub (0..1). */
|
|
146
146
|
hubFanInRatio: number;
|
|
147
147
|
ignore: string[];
|
|
148
|
-
/** Whether current thresholds are
|
|
148
|
+
/** Whether current thresholds are provisional. False for the calibrated defaults. */
|
|
149
149
|
preliminary: boolean;
|
|
150
150
|
}
|
|
151
151
|
//#endregion
|
|
@@ -184,14 +184,13 @@ interface ScoreInput {
|
|
|
184
184
|
config: ResolvedConfig;
|
|
185
185
|
}
|
|
186
186
|
declare function computeScore(input: ScoreInput): SlopScore;
|
|
187
|
-
/** Bands are labels for the score, not extra thresholds
|
|
187
|
+
/** Bands are labels for the score, not extra detection thresholds. */
|
|
188
188
|
declare function levelFor(score: number): SlopLevel;
|
|
189
189
|
//#endregion
|
|
190
190
|
//#region src/config.d.ts
|
|
191
191
|
/**
|
|
192
|
-
* Default thresholds
|
|
193
|
-
* docs/thresholds.md)
|
|
194
|
-
* Stage-4 victim repo. The god gates are a conjunction (members AND clusters AND
|
|
192
|
+
* Default thresholds calibrated on the 22-repo corpus (see
|
|
193
|
+
* docs/thresholds.md). The god gates are a conjunction (members AND clusters AND
|
|
195
194
|
* complexity), so `minMembers` is kept sensitive — precision comes from the
|
|
196
195
|
* cluster + complexity requirement, not from a high member floor.
|
|
197
196
|
* Full reference: docs/configuration.md.
|
package/dist/src.js
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stopslop",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Detects AI-agent slop that linters miss: over-complex functions, god modules/classes, dumped responsibilities.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"clone-alert": "^1.1.3",
|
|
54
|
-
"knip": "
|
|
54
|
+
"knip": "6.31.0",
|
|
55
55
|
"oxc-parser": "^0.139.0",
|
|
56
56
|
"picocolors": "^1.1.1"
|
|
57
57
|
},
|
package/schema.json
CHANGED
|
@@ -466,6 +466,9 @@
|
|
|
466
466
|
"catalog": {
|
|
467
467
|
"$ref": "#/definitions/knip/definitions/ruleValue"
|
|
468
468
|
},
|
|
469
|
+
"catalogReferences": {
|
|
470
|
+
"$ref": "#/definitions/knip/definitions/ruleValue"
|
|
471
|
+
},
|
|
469
472
|
"cycles": {
|
|
470
473
|
"$ref": "#/definitions/knip/definitions/ruleValue"
|
|
471
474
|
},
|
|
@@ -639,6 +642,7 @@
|
|
|
639
642
|
"enumMembers",
|
|
640
643
|
"namespaceMembers",
|
|
641
644
|
"catalog",
|
|
645
|
+
"catalogReferences",
|
|
642
646
|
"cycles"
|
|
643
647
|
]
|
|
644
648
|
}
|
|
@@ -1007,6 +1011,10 @@
|
|
|
1007
1011
|
"title": "markdownlint plugin configuration (https://knip.dev/reference/plugins/markdownlint)",
|
|
1008
1012
|
"$ref": "#/definitions/knip/definitions/plugin"
|
|
1009
1013
|
},
|
|
1014
|
+
"marko": {
|
|
1015
|
+
"title": "marko plugin configuration (https://knip.dev/reference/plugins/marko)",
|
|
1016
|
+
"$ref": "#/definitions/knip/definitions/plugin"
|
|
1017
|
+
},
|
|
1010
1018
|
"mdx": {
|
|
1011
1019
|
"title": "mdx plugin configuration (https://knip.dev/reference/plugins/mdx)",
|
|
1012
1020
|
"$ref": "#/definitions/knip/definitions/plugin"
|
|
@@ -1107,6 +1115,10 @@
|
|
|
1107
1115
|
"title": "openapi-ts plugin configuration (https://knip.dev/reference/plugins/openapi-ts)",
|
|
1108
1116
|
"$ref": "#/definitions/knip/definitions/plugin"
|
|
1109
1117
|
},
|
|
1118
|
+
"openclaw": {
|
|
1119
|
+
"title": "openclaw plugin configuration (https://knip.dev/reference/plugins/openclaw)",
|
|
1120
|
+
"$ref": "#/definitions/knip/definitions/plugin"
|
|
1121
|
+
},
|
|
1110
1122
|
"orval": {
|
|
1111
1123
|
"title": "orval plugin configuration (https://knip.dev/reference/plugins/orval)",
|
|
1112
1124
|
"$ref": "#/definitions/knip/definitions/plugin"
|
|
@@ -1323,6 +1335,10 @@
|
|
|
1323
1335
|
"title": "tauri plugin configuration (https://knip.dev/reference/plugins/tauri)",
|
|
1324
1336
|
"$ref": "#/definitions/knip/definitions/plugin"
|
|
1325
1337
|
},
|
|
1338
|
+
"temporal": {
|
|
1339
|
+
"title": "temporal plugin configuration (https://knip.dev/reference/plugins/temporal)",
|
|
1340
|
+
"$ref": "#/definitions/knip/definitions/plugin"
|
|
1341
|
+
},
|
|
1326
1342
|
"travis": {
|
|
1327
1343
|
"title": "travis plugin configuration (https://knip.dev/reference/plugins/travis)",
|
|
1328
1344
|
"$ref": "#/definitions/knip/definitions/plugin"
|