Production Readiness Engine / v3.0.0
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.
The problem
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.
Syntactically valid. Semantically broken. Exceptions disappear and failures become invisible.
A function named validateEmail that returns true unconditionally. Looks like a safety check. Does nothing.
API keys, passwords, and tokens committed to version control. Permanent, even after deletion.
Template literals and concatenation in query calls. The most exploited class of web vulnerability.
A score from 0 to 100 across five categories. A letter grade. A clear production-ready determination.
Every issue includes an explanation, an impact statement, a suggested fix, and a documentation link.
SARIF output for GitHub Code Scanning. Configurable exit codes. Severity thresholds. Merge gates.
Run npx clean-slop scan. Sensible defaults cover the common cases. Configuration is available when you need it.
Rule categories
Each category contributes to a separate score. All are enabled by default. Any can be disabled per project or per rule.
Rule index
Catch blocks that contain no statements silently swallow exceptions. Errors disappear and failures become invisible in production logs.
TODO and FIXME comments, and throw new Error('Not implemented') placeholders that indicate unfinished work that was never completed.
Functions named validate*, isValid*, check*, or verify* whose body unconditionally returns true. All input passes. Nothing is validated.
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.
Control-flow nesting deeper than 4 levels. Deep nesting indicates logic that was generated without applying early-return or extraction patterns.
Cyclomatic complexity exceeding 10. Each unit of complexity is an independent execution path that must be understood and tested.
Statements after return, throw, break, or continue that can never execute. Indicates control-flow errors common in generated code.
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.
SQL queries built with template literals or string concatenation. The most exploited class of web application vulnerability.
exec(), spawn(), and related child_process calls with dynamically constructed first arguments. Shell metacharacters in user input lead to remote code execution.
File system operations with dynamic path arguments. Without validation, ../ sequences allow reading and writing outside the intended directory.
eval() and new Function() execute strings as JavaScript. Any external data in the string is a code injection vector.
Dynamic bracket assignment and unsafe deep-merge operations that may allow an attacker to inject properties into Object.prototype.
Math.random() for security tokens, MD5 and SHA1 hash algorithms, and ECB cipher mode. None of these are cryptographically safe.
Wildcard CORS origins, cookies with httpOnly: false, cookies with secure: false, and sameSite: 'none' without secure: true.
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.
Async functions that return an un-awaited Promise. Exceptions thrown by the returned call will not be caught by surrounding try/catch blocks.
while(true) and for(;;) loops without a reachable break, return, or throw. Blocks the Node.js event loop and renders the server unresponsive.
Source files exceeding 400 lines. Large files create merge conflicts, slow code review, and indicate missing module boundaries.
Import patterns that commonly cause circular dependency cycles. Detected via single-file heuristics for barrel re-export patterns.
console.log(), console.debug(), and related debug methods. Leaks internal state, pollutes logs, and may expose sensitive data in aggregation systems.
Localhost URLs, debug flags set to true, and mock function implementations that were never replaced with production code.
Scoring
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.
Output 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.
Get started
No configuration required. Works on any JavaScript or TypeScript project.