Comment repeats the code
This is how the comment reads inline, under the flagged line.
Why it matters
// increment counter above counter++ doubles the reading and goes stale when the code changes. It's the most common AI comment.
What to do
Delete it. Write comments for what the code can't say: why, constraints, links.
Examples
// Get the user const user = getUser(id);
const user = getUser(id);
What it catches
It reads the shape of the code: functions, blocks, loops and calls. Languages: TypeScript and JavaScript, Python, Go, Rust, Java, C and similar. Scope: All files. These cases are the rule's own tests: the first set must be flagged and the second must not.
Flagged
// Get the user const user = getUser(id);
# return the user return user
Left alone
// Cached: lookups repeat within one request const user = getUser(id);
Research
Comments and docstrings that repeat the next line, the function name or the structure ("Step 1", "This function handles"). The reader learns nothing, and the comment drifts out of date when the code changes.
Turn it off or change it
In a config file for the CLI, or in the API's rules field:
{
"rules": {
"disable": [
"restating-comment"
],
"severity": {
"restating-comment": "medium"
}
}
}