Variable, method, and class names should clearly and accurately describe their purpose, content, or behavior. Misleading or vague names create confusion and make code harder to understand and maintain.
Variable, method, and class names should clearly and accurately describe their purpose, content, or behavior. Misleading or vague names create confusion and make code harder to understand and maintain.
Examples of improvements:
local_repo
→ lockfile_repo
when it specifically holds lockfile datarepo_with_packages
→ repo_add_default_packages
to reflect what it doesget_system_python()
→ get_running_python()
when it returns the currently executing Pythoncached
→ cached_wheel
when specifically referring to wheel cachingmodule_name()
function should not do the opposite of converting module namesWhen reviewing code, ask: “Does this name accurately tell me what this thing is or does?” If there’s any ambiguity or if the name could mislead someone reading the code, choose a more descriptive alternative.
Enter the URL of a public GitHub repository