de-sloppify
De-Sloppify
Core Principles
-
Systematic over random — Follow the cleanup pipeline in order. Formatting first (because it touches every file), dead code last (because earlier steps might reveal it). Random cleanup misses things and creates merge conflicts.
-
Verify after each step — Run
dotnet buildanddotnet testafter every step. A cleanup that breaks something is worse than the mess it was fixing. Never batch multiple cleanup types into one untested change. -
Safe removals only — Before removing any code flagged as "dead," verify it isn't used via reflection, DI conventions, or serialization.
find_referencesshows compile-time usage; grep for string-based references that Roslyn cannot track. -
One concern at a time — Don't mix formatting fixes with logic changes. Don't combine dead code removal with new feature work. Separate concerns make code review possible and reverts safe.
-
Commit between phases — Each cleanup step gets its own commit. If Step 4 (dead code removal) breaks something, revert just that commit without losing the formatting and analyzer fixes from Steps 1-3.
Patterns
7-Step Cleanup Pipeline
Execute in order. Verify (build + test) after each step. Commit each step separately.