The Boy Scout Rule is a maintenance habit: leave code slightly cleaner than you found it after making a change. It manages codebase entropy through small, continuous improvements. section 4.13 section 4.12
Apply the rule during ordinary development work:
- Refactor a small awkward section while completing a pull request. section 4.12
- Clean up legacy code or remove dead code when the change makes that practical. section 4.12
- Rename variables to match established naming conventions rather than introducing inconsistent terminology. section 4.12
A cleaner pull request
A developer changes one function and notices a misleading variable name nearby. Renaming it and removing an adjacent dead fragment leaves the touched area easier to understand without expanding the task into a large redesign. section 4.12
