When I was a Programmer Lead type, I used to love giving code reviews. I mean, what could be more satisfying than getting all anal with someone and pouring over their work to make sure that they met all of your coding standards. (So much more fun to do on someone else's code than your own...). But fun as it may be (for weirdos like me at least), there's no real reason to do this by hand when there are automated tools to handle the code checking.
The one I looked at today is SSW's Code Auditor, done by my dear Australian friend and RD Adam Cogan, the guy who also brings us all the "Better Rules To..." Adam's CodeAuditor is a Reg Ex-based tool written in C#, and has built-in rules to handle C#, VB, and web files. Some of the rules I would argue with--don't get me started on Option Strict, but I learned last year not to argue with Adam--and other rules just need to be configured to meet your own organization's coding standards. I played around with a few of the rules, and it's actually very easy to customize them, so don't just go with what's provided--let the built-in rules inspire you to get even more rigorous on your developers' (or your own) code.
(I'm still not sure what "kit up the cogs" means--must be an Australian thing.)
I ran the audit--it runs very fast, by the way--against some ASP.NET files I had created for a freelance consulting client recently to try it out, and naturally the audit found about 18 things it didn't like about me. I realized when I looked at the output (and looking back at the rules), that the WEB library of rules was really geared more towards HTML files, my first clue was this "error", (does this tool not know me at all??):
line 18 column 1 - Error: <asp:datagrid> is not recognized!
But the rules were great for pure HTML, things like avoiding <FONT> tags, requiring a <TITLE> tag, requiring the use of a specific CSS file, and some rules that will even help improve your Google page rankings, and I think Adam has a related article on optimizing your pages for Google. Also it looks like you can have the Code Auditor check the *output* of your ASP.NET pages to check the resultant HTML, so that's pretty cool.
Other features to note:
- Can automate the auditor to run on a schedule and email the reults--terrorize your developers! You only thought you could frighten them before with micromanaging them, just think, now you can micro-audit them too :)
- Rules are more customizable than FxCop, plus it runs against the source files themselves rather than the compiled assembly
- There are some very interesting sample rules to test for (completely customizable of course), such as requiring the use of the Exception Management Application Block
- Can specify certain elements as required on all pages in a web app
- Here's a rule we can all agree on for .vb files, prohibit the use of "On Error Resume Next". Some people don't realize that this one actually survived into VB.NET--please don't tell them!
To me, it seemed particularly useful on my VB class files, where most of the logic was for this application anyway. There are also plenty of rules built in for windows developers, whether you're using VB or C#. Go give it a try, there's a free trial download available here.