Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bug number comments [closed]

Why would you add

//Bug 1024

comments into a source controlled code base? Most bug tracking and source control systems are better equipted to keep track of this information. In source control, a label or comment can be used with the checkin. In a bug tracker the revision number can be added to the bug's resolution. So why comment the code? Especial since these comments relevancy is very short lived and they tend to build up littering the code base.

like image 547
Aaron Fischer Avatar asked Oct 02 '08 16:10

Aaron Fischer


3 Answers

I found one of these helpful the other day in our code base.

I said "why is he calling the initialization function a second time, this late in the workflow??"

The bug comment let me go right the issue description. When I retooled the code, I was sure to include that bug in my tests and didn't reintroduce it.

Although I will say that in general I agree with you and don't insert those myself.

I would have preferred that the developer in question fixed the bug in a more meaningful way, so that I didn't have to wonder about the code in the first place.

like image 143
rice Avatar answered Sep 21 '22 12:09

rice


Ultimately, I think it's a bad practice. It's better to include why the bug exists (foos of type Y don't have property Z). You can include a "more in BugId 12345" along with that if you want.

If you're integrating on multiple levels, a source code view in trac can link directly to the BugId.

like image 44
Tom Ritter Avatar answered Sep 19 '22 12:09

Tom Ritter


Pure laziness. Sure, it takes more time in the long run, but in the short run "//Bug 1024" takes no effort whatsoever. The more code you have, the worse this is.

like image 44
Brian Avatar answered Sep 19 '22 12:09

Brian