Skip to content

no-restated-comment

Short standalone comment lexically restates the immediately following simple action.

Why

When a comment adds no rationale, scope, ordering, or constraint, it duplicates code and can become stale. Lexical similarity is advisory rather than proof of author intent.

Fix

Delete it if it merely narrates one statement. Preserve or rewrite comments that explain a reason, constraint, consequence, ordering requirement, or meaningful region label.

Examples

Before — flagged Comment repeats the action
service.py
def load_profile(profile_id):
# Get profile by ID
return get_profile_by_id(profile_id)
After — preferred Comment adds operational context
service.py
def load_profile(profile_id):
# The replica may lag after signup, so read from primary.
return get_profile_by_id(profile_id)