Versioned or boastful name
This is how the comment reads inline, under the flagged line.
Why it matters
parseV2, fetchDataNew, enhancedSearch mean a second copy was added beside the first instead of replacing it. Names should say what a thing does.
What to do
Replace the old version, delete it, and give the survivor the plain name.
Examples
export function fetchUserV2(id) { ... }export function fetchUser(id) { ... }What it catches
It reads a pattern on each line, aware of strings and comments. 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
function parseDataNew(x) {}const enhancedSearch = 1;
def load_final(x):
return x
Left alone
const newValue = 1;
function isNew(x) {}const parse = 1;
awsCopy(a, b);
const s = n.toFixed(2);
expect(newSoftLockups(a)).toBeNull();
Research
Versioned or boastful names (`saveV2`, `parseNew`, `EnhancedClient`). The name records how the code was edited instead of what it does, and it implies a second copy.
- KarpeSlop
- skill: code-review
- owner's notes
Turn it off or change it
In a config file for the CLI, or in the API's rules field:
{
"rules": {
"disable": [
"versioned-name"
],
"severity": {
"versioned-name": "low"
}
}
}
parseDataNewnames a version, not a meaning. The old one is still around, or soon nobody will know which is which.