Is it a good idea?
As for mostly everything: it all depends on your team.
Some might be very receptive, some absolutely not. If we are talking of an in-house team, I believe it would work more easily with people who already trust you, and who have some sense of humor, as they will have to cope with something that looks un-corporate and hence, at first sight, perhaps “unprofessional” to some. I personally had this issue when I tried to add some other “social improvement” fun-yet-serious artifacts, and backed off when I realized the team was not receptive and considered it more as a game I wanted to play rather than an actually useful PM practice.
Do others do so?
Well, not exactly badges, but along the same lines, and most certainly more impressive ;) check out for example the Swords and Shields Ceremony at Blizzard.
Metrics
- coding: this is not a metric (what exactly are you measuring?).
- commiting: this is a bad metric, quantity does not mean quality, and it is usually the opposite in software.
- completing tasks on time: possibly, but on scope too, and in such a way that the completion was not done in such a terrible way that it will raise bugs later on…
- …
Actually, I'll stop here. This has already been addressed.
You have to notice that the whole SE reputation and badges system relies on a community of human beings evaluating stuff. The only automation that takes place is in counting scores and associating badges to that score.
For testers, it should be a bit easier. The amount of spotted bugs, possibly weighted by severity, could be an easy metric. You could also consider the time before the report as another metric.
Philosophical considerations
Such a system is simply a model for reputation, and thus a way to simplify human trust attribution. However, for such a system to work, it has to map precisely to events fellow humans would acknowledge as impressive, or at least good in some way.
And I'm afraid this is exactly where you'll hit the limit of automation. By this very definition, automatically computable metrics cannot compute how good creative work is. Computers are very good at calculating stuff, not really at evaluating creative work. And coding is creative work.
Hence, I don't believe such a system would actually be sustainable to ask for contributions, as it would quickly raise doubts on whichever metric is used. Anything but fellow human evaluation will most probably be disregarded by other programmers, removing the very intention of improving reputation. It could even have the opposite effect, depending on the metrics used (“gold contributor? huh, this guy most probably did 30 shitty commits…”).
So, let's conclude. Adding a badge system is a cool goodie that simplifies such an evaluation by adding discrete steps to a continuous spectrum of evaluation, but for it to have any meaning, you need to make sure the way they are attributed is consensual. For this, I think the only valid metric is peers evaluation. This is difficult to obtain reliably on anything but projects with a solid community.
Hence, I would advise to think twice before trying this reward system, as it could be disregarded quite easily, making you waste effort and look foolish, or even backlash if a subset of the population buys into it but not another, segmenting your community / team.