Code reviews are a fact of life in any reasonably sophisticated development organization. Inevitably, the first code review session quickly deteriorates into taking the easy shots — discussing coding practices, variable naming conventions, capitalization issues, and the myriad other things that are critical to make it easy for developers to work on each others’ code.
Ideally, code reviews should be about algorithms and their implementations. The tedium of verifying adherence to in-house and general coding standards should be the domain of a program somewhere. Isn’t pattern analysis and parsing exactly the sort of thing that programs are supposed to be good at?
Thankfully, the answer to this question is “Yes,” and Parasoft’s CodeWizard is a product that definitely delivers. CodeWizard ships with more than 120 rules for good C++ coding practices and more than 25 rules for good C coding standards. Add to those general rules your own corporate SE (Software Engineering) guidelines, and you’ve got a pretty good start towards making code reviews much more efficient.
CodeWizard is actually two programs in one — CodeWizard and RuleWizard. The former is the engine that analyzes code against a set of coding and naming rules. RuleWizard is the application that simplifies creating those rules, keeps them up to date, and generates the rules in a format that can be used by CodeWizard.
You can use CodeWizard out of the box to help clean up your C and C++ code by using the rules mentioned earlier and scanning your code. Doing this is as easy as adding the appropriate CodeWizard bin directory to your path (depending on which versions of GCC and libc you’re using) and then typing codewizard source-code-file . CodeWizard then pops up a dialog box that displays any violations of its internal C and C++ coding standards.
Every company has at least one person who has opinions about every aspect of good coding style — standardized variable, subroutine, object, and method naming, and so on. Take my advice: Buy a copy of CodeWizard and give it to this person, who should then use the RuleWizard to create the rules for your company’s coding standards. Then test them by processing source code using CodeWizard. You’ll never have to invite him to a code review again. He will be virtually there in spirit every time a developer runs CodeWizard on his code. You can even save CodeWizard’s code analysis reports for examination later in internal and ASCII text forms.
Every Little Thing You Code is Magic
CodeWizard can take time to set up but immediately begins to pay back your development efforts the first time that it identifies coding and semantic problems in any code it analyzes.
CodeWizard really isn’t magic — it’s just well-designed, flexible software that can grow with the standards and requirements of a company. Such applications aren’t magic, they’re just rare and incredibly valuable.