This is probably quite an obvious thought, but it occurred to me when trying to review a checkin that was done by someone who just can’t help himself when it comes to cleaning up code. It’s an obsession, so whatever he is doing he can’t help but leave the code a little tidier. Lovely. Except of course when his 10 lines of changes are obscured by the fact that he has deleted dead code from a hundred places in the file. Very hard to review.
So after that, we have a simple rule: if you must clean up, make a “null change” checkin for the cleanup with a comment to match; and another checkin with the fix. Then each checkin has a single responsibility. The mnemonic for the rule is: if you feel like using an “and” in your checkin comment you have probably done it wrong.