Skip to content

no-trailing-numeric-unit-assignment-comment

A trailing comment redundantly labels a numeric assignment with its value and unit.

Why

A unit encoded only in a comment can drift; a unit-bearing name makes it machine- and reviewer-visible, while a duration type can enforce it.

Fix

Encode or reconcile the unit in the assigned name or typed value, such as timeout_ms or timedelta(minutes=5), then delete the duplicate comment.

Examples

Before — flagged Comment repeats the duration
settings.py
STALE_TIME = 5 * 60 * 1000 # 5 minutes
After — preferred Typed value carries the unit
settings.py
from datetime import timedelta
STALE_TIME = timedelta(minutes=5)

Formerly: trailing-value-narration