Test-Preserving Refactor
Refactoring is only safe if it is backed by tests.
The Protocol
- Run Tests First: Before touching any code, run the tests covering the target area. They MUST be green. If they are red, stop and fix the tests (or the code) first.
- Small Steps: Make one structural change at a time (e.g., extract a method).
- Run Tests Immediately: Run the tests immediately after the single structural change.
- Revert on Red: If the tests fail, you made a mist
[Description truncada. Veja o README completo no GitHub.]