3 ms·
To avoid this sort of thing, I have an editor macro that puts a comment like this at the end of the current line: alert("Fuck"); // DEBUG FIXME(dlitz) Yo
by dlitz 13y ago
To avoid this sort of thing, I have an editor macro that puts a comment like this at the end of the current line:
alert("Fuck"); // DEBUG FIXME(dlitz)
You can't see it here, but the comment also includes a few trailing spaces.
This way:
- "FIXME" gets gets highlighted in my text editor
- the whitespace triggers a git warning when committing
- I can configure a pre-push hook that refuses to push commits to origin that contain "DEBUG FIXME"
- I ever do accidentally push it, it's clear that the code was just there for debugging, and that I'm the person to talk to about it.
I also use "git add -p" to do a hunk-by-hunk review of my changes before committing them.
None of this is very hard or time-consuming, and I can't remember the last time that I accidentally pushed debugging code since I started doing this.