Skip to main content
New aislop v0.13.1 patch — calibrates hidden-fallback detection and fixes regex comment-masker false positives. Read the changelog →
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.

Flagged shape and clean shape.

Each example shows the exact code shape the rule is looking for, then the smallest version that keeps the intent without hiding risk or adding noise.

Flagged example
// Get the user's name
const name = user.name

// Loop through items
for (const item of items) {
  total += item.price
}
Why this trips

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

Clean example
const name = user.name

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

Remove comments that mirror the next statement. If the line needs explanation, rename the variable or extract a small function so the code carries the meaning.

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.