Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ Current checks focus on patterns that often show up in unreviewed generated code
- [async wrapper / `return await` noise](src/rules/async-noise/README.md)
- [pass-through wrappers](src/rules/pass-through-wrappers/README.md)
- [duplicate helper/function signatures across source files](src/rules/duplicate-function-signatures/README.md)
- [directory fan-out hotspots](src/rules/directory-fanout-hotspot/README.md)
- [duplicated test mock/setup patterns](src/rules/duplicate-mock-setup/README.md)

`scan` reports raw + normalized scores, hotspot tables, and grouped findings. Use `--json` when you want the full evidence payload.
Expand Down Expand Up @@ -240,7 +239,6 @@ The analyzer reads `slop-scan.config.ts`, `slop-scan.config.js`, `slop-scan.conf
{
"files": ["src/rules/**"],
"rules": {
"structure.directory-fanout-hotspot": { "enabled": false },
"structure.over-fragmentation": { "enabled": false }
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/default-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { promiseDefaultFallbacksRule } from "./rules/promise-default-fallbacks";
import { genericStatusEnvelopesRule } from "./rules/generic-status-envelopes";
import { genericRecordCastsRule } from "./rules/generic-record-casts";
import { stringifiedUnknownErrorsRule } from "./rules/stringified-unknown-errors";
import { directoryFanoutHotspotRule } from "./rules/directory-fanout-hotspot";
import { duplicateFunctionSignaturesRule } from "./rules/duplicate-function-signatures";
import { passThroughWrappersRule } from "./rules/pass-through-wrappers";
import { duplicateMockSetupRule } from "./rules/duplicate-mock-setup";
Expand Down Expand Up @@ -49,7 +48,6 @@ export function createDefaultRegistry(): Registry {
registry.registerRule(stringifiedUnknownErrorsRule);
registry.registerRule(passThroughWrappersRule);
registry.registerRule(duplicateFunctionSignaturesRule);
registry.registerRule(directoryFanoutHotspotRule);
registry.registerRule(duplicateMockSetupRule);

registry.registerReporter(textReporter);
Expand Down
8 changes: 4 additions & 4 deletions tests/benchmark-history.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ describe("benchmark history support", () => {
expect(summary.repos.every((repo) => repo.series.length === 2)).toBe(true);
expect(
summary.repos.find((repo) => repo.id === "slop-heavy")?.deltaFromPrevious?.repoScore,
).toBe(2);
expect(summary.repos.find((repo) => repo.id === "mixed")?.deltaFromPrevious?.repoScore).toBe(
-1,
);
).toBeCloseTo(2, 6);
expect(
summary.repos.find((repo) => repo.id === "mixed")?.deltaFromPrevious?.repoScore,
).toBeCloseTo(-1, 6);
expect(
summary.repos.find((repo) => repo.id === "slop-heavy")?.highest?.blendedVsPinnedBaseline,
).toBe(adjustedSlopHeavyWeekTwo.blended.vsPinnedBaseline);
Expand Down
23 changes: 9 additions & 14 deletions tests/fixtures-regression.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,18 @@ describe("fixture regression suite", () => {
createDefaultRegistry(),
);

expect(result.repoScore).toBeCloseTo(10.8666666667, 6);
expect(result.findings).toHaveLength(4);
expect(result.repoScore).toBeCloseTo(7.7, 6);
expect(result.findings).toHaveLength(3);
expect([...new Set(result.findings.map((finding) => finding.ruleId))].sort()).toEqual([
"defensive.async-noise",
"defensive.error-obscuring",
"structure.directory-fanout-hotspot",
"structure.pass-through-wrappers",
]);
expect(result.fileScores.map((score) => score.path)).toEqual([
"src/service.ts",
"src/error.ts",
]);
expect(result.directoryScores.map((score) => score.path)).toEqual(["src/fragments"]);
expect(result.directoryScores).toHaveLength(0);
});

test("mixed fixture localizes hotspots to the slop subtree", async () => {
Expand All @@ -50,9 +49,9 @@ describe("fixture regression suite", () => {
createDefaultRegistry(),
);

expect(result.repoScore).toBeCloseTo(9.7, 6);
expect(result.repoScore).toBeCloseTo(6.7, 6);
expect(result.fileScores[0]?.path).toBe("src/slop/service.ts");
expect(result.directoryScores[0]?.path).toBe("src/slop");
expect(result.directoryScores).toHaveLength(0);
expect(result.fileScores.every((score) => score.path.startsWith("src/slop/"))).toBe(true);
});

Expand All @@ -68,9 +67,9 @@ describe("fixture regression suite", () => {
expect(output.status).toBe(0);

const report = JSON.parse(output.stdout);
expect(report.summary.repoScore).toBeCloseTo(10.8666666667, 6);
expect(report.summary.findingCount).toBe(4);
expect(report.directoryScores[0].path).toBe("src/fragments");
expect(report.summary.repoScore).toBeCloseTo(7.7, 6);
expect(report.summary.findingCount).toBe(3);
expect(report.directoryScores).toHaveLength(0);
expect(report.fileScores[0].path).toBe("src/service.ts");
});

Expand All @@ -88,11 +87,7 @@ describe("fixture regression suite", () => {
"strong Found 1 error-obscuring catch block defensive.error-obscuring",
);
expect(output.stdout).toContain(" at src/error.ts:2:1");
expect(output.stdout).toContain(
"medium Directory fan-out is a repo hotspot (7 files vs baseline 1.0) structure.directory-fanout-hotspot",
);
expect(output.stdout).toContain(" at src/fragments:1:1");
expect(output.stdout).toContain("4 findings");
expect(output.stdout).toContain("3 findings");
expect(output.stdout).not.toContain("slop-scan report");
});

Expand Down
3 changes: 1 addition & 2 deletions tests/heuristics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ describe("heuristic rule pack", () => {
expect(ruleIds.has("defensive.stringified-unknown-errors")).toBe(true);
expect(ruleIds.has("defensive.async-noise")).toBe(true);
expect(ruleIds.has("structure.pass-through-wrappers")).toBe(true);
expect(ruleIds.has("structure.directory-fanout-hotspot")).toBe(true);

expect(result.fileScores.some((score) => score.path === "src/service.ts")).toBe(true);
expect(result.directoryScores[0]?.path).toBe("src/fragments");
expect(result.directoryScores).toHaveLength(0);
expect(result.repoScore).toBeGreaterThan(0);
});

Expand Down
Loading