What is AI slop in code?
AI slop code is generated code accepted without enough review: unnecessary wrappers, comments that repeat the code, unfinished placeholders or tests changed to hide a failure. It can look tidy while making a project harder to maintain.
By Macaron · Updated October 30, 2026
Short answer. Review the behavior, not the suspected author. A static scanner can flag specific patterns in JavaScript and TypeScript; it cannot prove AI authorship, understand every requirement or certify a fix. Use the findings to guide a code review, then run the project's checks.
Common tells
- Comments that restate the next line instead of explaining why.
- try/catch blocks that only rethrow.
- if (x) return true; else return false;
- Placeholder comments like // ... rest of the code, left in a real file.
- Duplicated logic next to a helper that already does the job.
- Leftover debug logging and TODO stubs.
- Tests loosened, skipped or deleted to get to green.
Before and after: a redundant catch
This catch adds no recovery or context. JSON.parse already throws when parsing fails, so removing the wrapper preserves that behavior.
Before
function parseSettings(raw) {
try {
return JSON.parse(raw);
} catch (error) {
throw error;
}
}After
function parseSettings(raw) {
return JSON.parse(raw);
}Keep catches that recover, translate errors or add useful context. Review stack traces and observability requirements when changing error handling.
Before and after: boolean return noise
An if/else that only returns true or false can usually express the condition directly. Preserve boolean coercion: returning user.active alone could return undefined or a string.
Before
function isActive(user) {
if (user.active) {
return true;
} else {
return false;
}
}After
function isActive(user) {
return Boolean(user.active);
}A cleaner diff can still be wrong
A loop that returns immediately only examines the first item. Removing noisy wrappers will not tell you whether the requirement meant the first user, any user or every user.
// At least one user is active. Empty list: false. const anyActive = users.some(user => user.active); // Every user is active. Empty list: true. const allActive = users.every(user => user.active);
Choose the behavior from the requirement and test the empty-list case. This is a semantic decision for a reviewer, not an automatic cleanup.
What Macaron's code scanner checks
- restating-comment
- What it flagsSelected comments that repeat a nearby operation.
- Automatic cleanupRemoves matching comments; keep explanations of intent.
- rethrow-only-catch
- What it flagsA catch block that only rethrows the caught value.
- Automatic cleanupRemoves an eligible redundant wrapper.
- bool-if-else-return
- What it flagsBranches that return opposite boolean literals.
- Automatic cleanupReturns the condition, with coercion when needed.
- placeholder-code
- What it flagsComments such as '// ... rest of the code' where implementation may be missing.
- Automatic cleanupManual review; the scanner cannot invent the missing behavior.
- leftover-console
- What it flagsconsole.debug and selected debug-like console.log calls outside tests and shebang scripts.
- Automatic cleanupManual review; intentional logging can be useful.
| Rule | What it flags | Automatic cleanup |
|---|---|---|
| restating-comment | Selected comments that repeat a nearby operation. | Removes matching comments; keep explanations of intent. |
| rethrow-only-catch | A catch block that only rethrows the caught value. | Removes an eligible redundant wrapper. |
| bool-if-else-return | Branches that return opposite boolean literals. | Returns the condition, with coercion when needed. |
| placeholder-code | Comments such as '// ... rest of the code' where implementation may be missing. | Manual review; the scanner cannot invent the missing behavior. |
| leftover-console | console.debug and selected debug-like console.log calls outside tests and shebang scripts. | Manual review; intentional logging can be useful. |
These five rules are heuristics. They do not detect duplicated helpers across a repository, weakened test assertions, security vulnerabilities or all unfinished work. Human-written code can trigger them too; no finding is proof of AI authorship.
Why it matters
Noise makes real logic harder to review. A duplicated helper creates another place to maintain behavior; a weakened test removes protection for the next change. Review the full diff and project conventions rather than accepting a tidy-looking answer.
A review checklist for generated code
- 01Read the test changes first. Keep the original failing case and add coverage for the intended fix, including empty and error states.
- 02Search for an existing helper before accepting a new one. Compare its callers and error behavior.
- 03Review scanner findings individually. Keep comments that explain intent and catches that provide real recovery.
- 04Preview automatic edits, inspect the diff, then run the project's tests, type checks and lint command. A clean scan is not a passing test suite.
Check a snippet or a repository with Macaron
For a pasted snippet, open Code slop scan in the web workspace and sign in. Choose JavaScript, JSX, TypeScript or TSX, then review the line locations and rule names. Your snippet is sent to Macaron for the scan; it is not stored and no model is called. The web scan reports findings without changing the code.
For repository files, the Macaron CLI runs the rules locally without an API key. Start with a scan, preview automatic edits with --fix --dry-run, then review the diff and run your project's tests before keeping any changes. The syntax guard rejects edits that introduce additional syntax diagnostics; that guard does not prove runtime correctness.
macaron deslop src macaron deslop --fix src --dry-run macaron deslop src --json
In the desktop app, De-slop combines these rules with optional React Doctor checks for React projects. Review the findings and proposed changes before asking your coding agent to act on them.
Questions
Is all AI-written code slop?+
No. Slop is about care, not origin. The same patterns show up in rushed human code.
Can an AI code detector tell who wrote the code?+
Macaron does not determine authorship or report an AI probability. It flags selected code-quality patterns that can occur in human or generated code.
Can a linter catch it?+
Some of it. Rethrow-only catches and boolean if/else returns are mechanical. Duplicated helpers, loosened tests and incorrect requirements need a reader who knows the codebase.
Does a clean scan mean my code is correct?+
No. A clean scan means none of the selected rules matched. Run tests, type checks and relevant security checks, and review the intended behavior separately.
Which languages does macaron deslop cover?+
JavaScript and TypeScript, including JSX and TSX. The desktop app adds optional React-specific checks through React Doctor.
Should I block pull requests on it?+
Choose rules appropriate for your project with --rules. The CLI scan exits with code 1 when it finds anything; review false positives before making it a required check.