Adam Goucher has a great blog post on looking for comment-based code smells in software you’re testing.
Every occurrence of //TODO, //HACK, or God forbid, //FIX, is a pointer to a spot in the codebase where someone took a shortcut. More often than not those shortcuts highlight unfinished or outright sloppy work – spots rife for bugs, complexity, and all the other messes associated with pain.
Adam’s post has a Python script you can use to report on these problems. PowerShell lets you do the same thing as well in a bit terser fashion. Here’s how I skinned this cat in PowerShell:
Get-ChildItem . -include *.cs -recurse | Select-String -pattern "//todo","//hack","//fix"
Tests\FunctionalTests\Telligent.Evolution.Tests.Selenium\Telligent.Evolution.Tests.Selenium\Common\Utilities.cs:158: //HACK: TolLower is a workaround for Unfuddle 3458. Remove when fixed.
[1] The offending author of that line is rumored to look suspiciously like this blog’s author who declined to comment on the matter.
Updated: Fixed snippet formatting
No comments:
Post a Comment