Just read “//TODO: Uncomment Later” over at the newly renamed “DailyWTF” (it’s now called Worse Than Failure, and while I understand Alex’s motivation for the name change, I think the original was better…) . It got me thinking; as part of the build process, do you have a task that checks for any TODO comments? (You do use TODO comments, right?) In addition, check out the comments to that post: I love the wolves story, classic!
That post got me thinking, as part of the TODO comment checking task we should also check for commented out code lines. I deplore seeing commented out code that developers have left in the codebase; it’s a warning sign that something smells. That’s what Source Control is for! The only time leaving commented out code is acceptable is to indicate that it shouldn’t be done that way WITH an associated clear and explanatory comment.
When I program against the .NET Framework, I’m happy swapping between C# and VB.NET, although I must confess a preference for C#, having spent many years programming in C. It occurred to me that it would be slightly easier to check for commented out code (without using System.CodeDom) by checking for lines that contain “\\” and “;” or “{” or “}”. OK, it might match a few false positives. What are your thoughts on this?…