Yesterday evening I slapped together a small tool for consistency checking of large codebases. It’s written in a similar spirit as Boost’s inspect tool, just slightly more sophisticated. Written in C#, it allows you to plug in your own checks easily. At the moment, I have a generic RegEx checker (just looks if a regular expression matches) and a line ending checker in my core tests and a bunch of niven specific ones (license, interfaces with
struct and not with
class, file header, @file comment in header matches file name, include guards are not reused, missing @author, outdated mail addresses). Some example output:
Loading checker from 'Checks' .. 'CrLfCheck' .. 1 checker loaded Loading checker from 'nivenChecks' .. 'CheckFileHeader' .. 'OutdatedMailAnteru' .. 'AuthorCheck' .. 'IncludeGuards' .. 'StructInterfaces' .. 'FilenameInHeader' .. 6 checker loaded Extensions: 'cpp' 'h' Running checks for 'archive.h' ++ OK ... 0 failures ... Running checks for 'core.h' Include guards : Include guard already used >> Line: 9: The include guard 'NIV_CORE_H' has been already used Interfaces : Interface defined with 'class' >> Line: 17: Interface 'IFileSystem' uses 'class' instead of 'struct' -- FAILED ... 2 failures ... 39 failures (101 files total)
It was written against the .NET Framework 2.0, but it should work with Mono as well. On startup, it loads up your assembly and pulls the checks out of it, so it’s really easy to extend. I’m running it now along with the build to see which files need some attention. By the way, anonymous comments are enabled, so you can tell me what features would you like to see from such a litte helper?