Skip to content
Sarj Code Standards

excessive-commentary

Production code carries no ordinary comments; express intent in names, types and code.

Why

Comments drift from the code they describe. Names, types, structure and executable contracts keep the explanation checked; documentation owns longer context.

Fix

Delete the comment. Move its meaning into a name, type, helper or assertion, or into documentation. Preserve machine directives, their suppression descriptions and legal notices.

Examples

Before — flagged A concise constraint comment still restates what the code should name
app.py
def record(pool):
# Settle the row before cancellation can close the pool.
shield(insert_row(pool))
After — preferred The name carries the constraint
app.py
def record(pool):
shield(insert_row_before_pool_closes(pool))