alert("Fuck");
It made it to a single user who was testing it for me, on the other side of the planet. He spoke very little English, and for that I am grateful.That was my last push without review.
alert("Fuck");
It made it to a single user who was testing it for me, on the other side of the planet. He spoke very little English, and for that I am grateful.That was my last push without review.
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.
Not very helpful if someone else sees it, but also not profanity.
Then for production you can always do this at the top of your main JavaScript include:
var console = {};
console.log = function(){};Git pre-commit hooks for alert are helpful since few and far between are the circumstances where an alert is actually wanted in production. While you're at it you can add one for whatever set of profane terms, if you roll like that.
"I don't use bad words in test code."
This is actually really important. We had this happen with a customer whilst UAT testing. The project schedules were under pressure and as a result the customer went nuts (rightly so) and we had to make some concessions to customer as amends.It isn't just curse / bad words. Equally as bad are comments like:
"this was the customer's stupid idea not ours"
Also, if you really have to output test stuff in the browser use console.log('message') and not alert('message').Then for production you can always do this at the top of your main JavaScript include:
var console = {};
console.log = function(){}; window.alert = function(){};