Skip to main content
New aislop v0.9.4: four new Python rules from the SlopCodeBench paper, plus a CLI star prompt and GitHub Discussions. Read more →
ai-slop/trivial-comment auto-fixable

Trivial comment.

A single-line comment that restates exactly what the next line of code does. Removing it changes nothing for the reader.

Bad — what an agent ships
// Get the user's name
const name = user.name

// Loop through items
for (const item of items) {
  total += item.price
}
Good — what aislop hands back
const name = user.name

for (const item of items) {
  total += item.price
}

Agents narrate every step when generating code, then leave the narration in. The reader gets two copies of the same information.

How this rule is justified.

Rule id

ai-slop/trivial-comment

Enforcing engine

ai-slop

Detector strategy

Deterministic line match: compares the comment text against the tokens of the following statement and flags near-restatements.

Legitimate code that is NOT flagged

Comments explaining intent, edge cases, or units (rather than restating the statement) are not flagged.

Evidence

Verbosity signals derive from SlopCodeBench and recurred across the first public scan batch.