Production Readiness Engine  /  v3.0.0

Should this code
go to production?

clean-slop is a static analysis engine for JavaScript and TypeScript that detects security vulnerabilities, reliability failures, AI-generated code patterns, and production antipatterns before they reach users.

Install Documentation GitHub
clean-slop scan src
$ npx clean-slop scan src
 
Scanning /project/src   47 files
 
CRITICAL  Hardcoded secret detected — src/config/db.ts:14
CRITICAL  SQL injection via template literal — src/routes/users.ts:31
HIGH  Empty catch block — src/services/auth.ts:88
HIGH  Fake validation: validateUser always returns true — src/middleware/validate.ts:12
HIGH  Math.random() used for token generation — src/utils/crypto.ts:5
MEDIUM  Hardcoded localhost URL — src/api/client.ts:3
LOW  console.log() in production path — src/handlers/payment.ts:44
 
─────────────────────────────────────────────────────────
ai-slop          41/100
security          20/100
reliability          80/100
maintainability          97/100
production-readiness          84/100
 
Overall                       64/100 Grade: D
 
NOT PRODUCTION READY Score below threshold (70)

The problem

Linters catch style.
clean-slop catches intent.

AI code generators produce code that compiles, passes tests, and looks reasonable. They also produce patterns that fail silently, expose credentials, bypass validation, and break under load.

What existing tools miss

Empty catch blocks

Syntactically valid. Semantically broken. Exceptions disappear and failures become invisible.

Fake validation

A function named validateEmail that returns true unconditionally. Looks like a safety check. Does nothing.

Hardcoded secrets

API keys, passwords, and tokens committed to version control. Permanent, even after deletion.

SQL built from strings

Template literals and concatenation in query calls. The most exploited class of web vulnerability.

What clean-slop provides

Structured scoring

A score from 0 to 100 across five categories. A letter grade. A clear production-ready determination.

Actionable output

Every issue includes an explanation, an impact statement, a suggested fix, and a documentation link.

CI integration

SARIF output for GitHub Code Scanning. Configurable exit codes. Severity thresholds. Merge gates.

Zero configuration required

Run npx clean-slop scan. Sensible defaults cover the common cases. Configuration is available when you need it.


22 rules. 5 categories.

Each category contributes to a separate score. All are enabled by default. Any can be disabled per project or per rule.

AI Slop
7 rules
Empty catch blocks, fake validation, TODO implementations, giant functions, dead code, excessive nesting, high complexity.
Security
8 rules
Hardcoded secrets, SQL injection, command injection, path traversal, unsafe eval, prototype pollution, weak crypto, dangerous CORS.
Reliability
3 rules
Unhandled promises, missing await in async functions, infinite loops without exit conditions.
Maintainability
2 rules
Giant files over 400 lines, circular import patterns that cause initialization failures.
Production
2 rules
Console debug statements, localhost URLs, debug flags set to true, mock implementations left in place.

Rule index

Every rule, explained.

ai-slop/empty-catch high

Catch blocks that contain no statements silently swallow exceptions. Errors disappear and failures become invisible in production logs.

ai-slop/todo-implementation high

TODO and FIXME comments, and throw new Error('Not implemented') placeholders that indicate unfinished work that was never completed.

ai-slop/fake-validation high

Functions named validate*, isValid*, check*, or verify* whose body unconditionally returns true. All input passes. Nothing is validated.

ai-slop/giant-function medium

Functions exceeding 80 lines. Functions exceeding 200 lines are flagged at high severity. Long functions are a reliable indicator of generated-and-never-reviewed code.

ai-slop/excessive-nesting medium

Control-flow nesting deeper than 4 levels. Deep nesting indicates logic that was generated without applying early-return or extraction patterns.

ai-slop/high-complexity medium

Cyclomatic complexity exceeding 10. Each unit of complexity is an independent execution path that must be understood and tested.

ai-slop/dead-code medium

Statements after return, throw, break, or continue that can never execute. Indicates control-flow errors common in generated code.

security/hardcoded-secrets critical

API keys, passwords, tokens, and private keys in source files. Detected via pattern matching for AWS keys, GitHub tokens, Stripe keys, database connection strings, and JWT secrets.

security/sql-injection critical

SQL queries built with template literals or string concatenation. The most exploited class of web application vulnerability.

security/command-injection critical

exec(), spawn(), and related child_process calls with dynamically constructed first arguments. Shell metacharacters in user input lead to remote code execution.

security/path-traversal critical

File system operations with dynamic path arguments. Without validation, ../ sequences allow reading and writing outside the intended directory.

security/unsafe-eval critical

eval() and new Function() execute strings as JavaScript. Any external data in the string is a code injection vector.

security/prototype-pollution high

Dynamic bracket assignment and unsafe deep-merge operations that may allow an attacker to inject properties into Object.prototype.

security/weak-crypto high

Math.random() for security tokens, MD5 and SHA1 hash algorithms, and ECB cipher mode. None of these are cryptographically safe.

security/dangerous-cors high

Wildcard CORS origins, cookies with httpOnly: false, cookies with secure: false, and sameSite: 'none' without secure: true.

reliability/unhandled-promise high

Calls to async APIs whose returned Promise is discarded. Rejection causes a process crash in Node.js 15+ or silent data loss in earlier versions.

reliability/missing-await high

Async functions that return an un-awaited Promise. Exceptions thrown by the returned call will not be caught by surrounding try/catch blocks.

reliability/infinite-loop high

while(true) and for(;;) loops without a reachable break, return, or throw. Blocks the Node.js event loop and renders the server unresponsive.

maintainability/giant-file medium

Source files exceeding 400 lines. Large files create merge conflicts, slow code review, and indicate missing module boundaries.

maintainability/circular-imports medium

Import patterns that commonly cause circular dependency cycles. Detected via single-file heuristics for barrel re-export patterns.

production-readiness/no-console-log low

console.log(), console.debug(), and related debug methods. Leaks internal state, pollutes logs, and may expose sensitive data in aggregation systems.

production-readiness/no-localhost-urls medium

Localhost URLs, debug flags set to true, and mock function implementations that were never replaced with production code.


A number you can act on.

Each category starts at 100. Issues deduct points by severity: critical issues deduct 20, high deducts 10, medium deducts 4, low deducts 1. The overall score is the average of all five categories.

Configure a failThreshold in your CI pipeline. Set maxIssues.critical: 0 to block any merge with a critical severity finding. Scores are consistent and reproducible.

Grade thresholds: A 90 and above, B 75 and above, C 60 and above, D 40 and above, F below 40.

Overall Score
/100
ai-slop
41
security
20
reliability
80
maintainability
97
production
84

Output formats

One tool. Five formats.

Use the text reporter during development. Use JSON for custom dashboards. Use SARIF for GitHub Code Scanning. Use Markdown for automated PR comments. Use HTML for reports you share with stakeholders.

Text
Color-coded terminal output with file grouping, severity labels, code snippets, and fix suggestions. Default format.
JSON
Full machine-readable scan result. Includes every issue, score breakdown, and configuration. For custom tooling and dashboards.
HTML
Self-contained single-file report with severity filtering. No external dependencies. For CI artifacts and non-technical stakeholders.
Markdown
GitHub-flavored Markdown with badge URLs, score table, and collapsed sections. For automated PR comments via GitHub Actions.
SARIF 2.1.0
Static Analysis Results Interchange Format. Compatible with GitHub Code Scanning, Azure DevOps, and VS Code SARIF Viewer.
Custom (Plugin)
Implement the Reporter interface and register it via the plugin system to generate any output format your pipeline requires.

Get started

Run it now.

No configuration required. Works on any JavaScript or TypeScript project.

$ npm install -D clean-slop