Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

slop-scan

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slop-scan

Deterministic CLI for finding AI-associated slop patterns in JavaScript and TypeScript repositories.

latest
Source
npmnpm
Version
0.3.0
Version published
Weekly downloads
5.9K
15.9%
Maintainers
1
Weekly downloads
 
Created
Source

slop-scan

Deterministic CLI for finding AI-associated slop patterns in JavaScript and TypeScript repositories.

Scan a repo, surface the hotspots, and compare codebases using normalized slop metrics.

slop-scan is a slop scanner, not an authorship detector. It reports explainable patterns and suspicious density. It does not claim who wrote the code.

Why use it

  • Find the hotspots fast — see which files and directories concentrate the most suspicious patterns
  • Understand why something was flagged — every finding includes a rule ID and evidence
  • Compare repos fairly — normalize by file count, logical KLOC, and function count
  • Benchmark heuristics over time — rerun the pinned benchmark set and watch movement

Good fit for

  • checking third-party repos that feel vibe-coded
  • comparing known AI-generated repos to mature OSS baselines
  • finding low-judgment boilerplate in your own codebase
  • iterating on deterministic slop heuristics

Install

Install globally with npm:

npm install -g slop-scan

Install it in a project and run it with npm tools:

npm install --save-dev slop-scan
npx slop-scan scan .

For local development in this repo:

bun install

Quick start

Scan the current repo:

slop-scan scan .

Scan the current repo in lint mode:

slop-scan scan . --lint

Scan another repo and get JSON:

slop-scan scan /path/to/repo --json

Recreate the pinned benchmark set from a source checkout:

bun run benchmark:update

Use it like a linter

Use --lint when you want human-readable findings in local runs, CI logs, or PR checks.

slop-scan scan . --lint

Example output:

medium  Found 3 duplicated function signatures  structure.duplicate-function-signatures
  at src/users/normalize.ts:1:1
  at src/teams/normalize.ts:1:1
  at src/accounts/normalize.ts:1:1

JSON output

Use --json when you want full-fidelity output for scripts, CI, or post-processing.

slop-scan scan . --json

Example CI check:

slop-scan scan . --json | jq -e '.summary.findingCount == 0'

The CLI currently exits non-zero for CLI/runtime errors, not for findings.

Delta comparisons

Use delta when you want a machine-readable comparison between two scans.

Compare two paths directly:

slop-scan delta ../main .
slop-scan delta --base ../main --head . --json

Compare two saved reports:

slop-scan scan ../main --json > base.json
slop-scan scan . --json > head.json
slop-scan delta --base-report base.json --head-report head.json

Fail CI only when new or worse occurrence-level findings show up:

slop-scan delta --base ../main --fail-on added,worsened

delta --json emits a generic report format with:

  • base/head scan summaries
  • occurrence-level change classification (added, resolved, worsened, improved)
  • per-path score deltas
  • report metadata and config hashes so downstream tools can detect mismatched scan conditions
  • stable per-occurrence fingerprints for built-in rules, so grouped findings can match across rescans without relying on rendered message text

What it catches

Current checks focus on patterns that often show up in unreviewed generated code:

  • log-and-continue catch blocks
  • error-obscuring catch blocks (default-return or generic replacement error)
  • empty catch blocks
  • async wrapper / return await noise
  • pass-through wrappers
  • barrel density
  • duplicate helper/function signatures across source files
  • over-fragmentation
  • directory fan-out hotspots
  • placeholder comments
  • duplicated test mock/setup patterns

What you get back

  • raw repo score
  • normalized metrics:
    • score / file
    • score / KLOC
    • score / function
    • findings / file
    • findings / KLOC
    • findings / function
  • top file hotspots
  • top directory hotspots
  • grouped lint-style findings with --lint
  • full-fidelity findings with evidence in --json

Supported files

Current language support:

  • .ts
  • .tsx
  • .js
  • .jsx
  • .mjs
  • .cjs

Benchmarks

The repo ships with a pinned, recreatable benchmark set comparing known AI-generated repos against older solid OSS repos.

Blended score = geometric mean of the six normalized-metric ratios versus the mature OSS cohort medians, then rescaled so the mature OSS cohort median is 1.00. Higher means a repo is consistently noisier across the benchmark dimensions.

Cohort medians

MetricAI medianMature OSS medianRatio
Blended score3.481.003.48x
Score / file0.990.195.17x
Score / KLOC9.514.422.15x
Score / function0.230.092.49x
Findings / file0.310.074.44x
Findings / KLOC2.961.402.12x
Findings / function0.080.032.99x

Pinned benchmark snapshot

Ordered by blended score.

RepositoryCohortRefBlendedScore/fileScore/KLOCFindings/fileFindings/KLOC
garrytan/gstackai6cc094c5.942.3421.710.524.85
redwoodjs/agent-ciai4de00d63.980.9910.950.313.42
jiayun/DevWorkbenchaiea508623.771.0010.760.444.69
openclaw/openclawai44cf7473.501.0810.930.323.29
robinebers/openusageai857f5373.481.338.300.342.11
emdash-cms/emdashaidbaf8c62.470.756.670.232.02
FullAgent/fullingaid95060f2.400.539.510.162.96
cloudflare/vinextai28980b02.210.489.200.152.76
vitejs/vitemature-ossbdc53ab1.650.267.950.082.45
withastro/astromature-oss2c9bf5e1.630.275.680.092.02
modem-dev/hunkaib37663f1.320.384.710.131.55
egoist/tsupmature-ossb906f861.030.213.610.081.42
umami-software/umamimature-oss0a838641.010.154.170.061.61
sindresorhus/execamature-ossf3a2e840.990.174.850.051.37
antfu-collective/nimature-oss6d969050.730.114.680.020.94
mikaelbr/node-notifiermature-ossb36c2370.460.080.900.040.47
vercel/hypermature-oss2a7bb180.460.651.120.160.28

Full benchmark assets:

Configuration

The analyzer reads slop-scan.config.ts, slop-scan.config.js, slop-scan.config.mjs, slop-scan.config.cjs, or slop-scan.config.json from the scan root. Root .gitignore entries are also respected.

{
  "ignores": ["dist/**", "coverage/**", "**/*.generated.ts"],
  "plugins": {
    "acme": "slop-scan-plugin-acme"
  },
  "extends": ["plugin:acme/recommended"],
  "rules": {
    "structure.over-fragmentation": { "enabled": true, "weight": 1.2 },
    "comments.placeholder-comments": { "enabled": false },
    "acme/no-generated-wrapper": { "enabled": true, "options": { "threshold": 3 } }
  },
  "overrides": [
    {
      "files": ["src/rules/**"],
      "rules": {
        "structure.directory-fanout-hotspot": { "enabled": false },
        "structure.over-fragmentation": { "enabled": false }
      }
    }
  ]
}

Supported today:

  • ignores
  • plugins.<namespace> as either a package/path string or a plugin object in module configs
  • extends: ["plugin:<namespace>/<config>"]
  • rules.<id>.enabled
  • rules.<id>.weight
  • rules.<id>.options
  • overrides[].files
  • overrides[].rules.<id>.enabled
  • overrides[].rules.<id>.weight
  • overrides[].rules.<id>.options

Plugins

slop-scan can load third-party rule plugins and plugin preset configs from JSON or module configs.

For plugin setup, naming rules, and authoring examples, see docs/plugins.md. Simple plugin rules can now declare stable delta behavior with helpers like delta.byPath() / delta.byLocations(), and clustered rules can attach lightweight deltaKeys instead of building fingerprints manually.

See also:

This repo also commits a root slop-scan.config.json for self-scans and local development. It keeps the scan focused on the tool itself by excluding heavyweight benchmark checkouts and intentionally disables directory-structure rules under src/rules/**.

How it works

slop-scan is built as a pluggable engine:

  • language plugins
  • fact providers
  • rule plugins
  • reporters

That keeps the analyzer deterministic and extensible without turning it into one giant loop of ad hoc checks.

Docs

Contributing

Issues and pull requests are welcome.

Local validation

bun run format:check
bun run lint
bun test

Stable self-scan

bun run lint includes a stable self-scan.

It runs the last published slop-scan release against this repo using the committed root config in slop-scan.config.json, then compares the result to tests/fixtures/self-scan-stable-baseline.json.

The check currently fails only when the stable release reports either:

  • a higher finding count; or
  • a higher repo score.

Useful commands:

bun run lint:self
bun run lint:self:update

Use bun run lint:self:update only when you intentionally accept the new stable self-scan baseline.

Pre-commit hook

A Husky pre-commit hook runs:

bun run format:check
bun run lint

Heuristic changes

If you change rule behavior materially, also rerun:

bun run benchmark:update

License

MIT

Keywords

ai

FAQs

Package last updated on 16 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts