I'm a big believer in automating process where possible - instead of trying to remember style rules or dealing with inconsistent code across a codebase, just write a script to deal with it!<p>This one was particularly fun to write because it was an excuse to use the awesome parcon library (<a href="http://www.opengroove.org/parcon/parcon-tutorial.html" rel="nofollow">http://www.opengroove.org/parcon/parcon-tutorial.html</a>)
Been doing something like this but instead of a custom parser, I've been building it against clang's own AST instead of reinventing the wheel.
Neat. Playing with parsers is fun!<p>FWIW, a similar tool exists that works with most C-style languages, `uncrustify`. Might be worth looking into as well?<p><a href="http://uncrustify.sourceforge.net" rel="nofollow">http://uncrustify.sourceforge.net</a>
Or use a tool that fixes your style instead of just listing errors: <a href="http://clang.llvm.org/docs/ClangFormat.html" rel="nofollow">http://clang.llvm.org/docs/ClangFormat.html</a>
While I can appreciate style guidelines for code, I can't help but feel like this level of pedantry is excessive and probably a total waste of time in most cases.
clang-format exists to do the same thing <a href="http://clang.llvm.org/docs/ClangFormat.html" rel="nofollow">http://clang.llvm.org/docs/ClangFormat.html</a>