Generic software code style enforcer

Posted by FuzziBear on Programmers See other posts from Programmers or by FuzziBear
Published on 2012-09-12T02:46:32Z Indexed on 2012/09/12 3:48 UTC
Read the original article Hit count: 278

Filed under:
|
|

It seems to me to be a fairly common thing to do, where you have some code that you'd like to automatically run through a code style tool to catch when people break your coding style guide(s).

Particularly if you're working on code that has multiple languages (which is becoming more common with web-language-x and javascript), you generally want to apply similar code style guides to both and have them enforced.

I've done a bit of research, but I've only been able to find tools to enforce code style guidelines (not necessarily applying the code style, just telling you when you break code style guidelines) for a particular language. It would seem to me a reasonably trivial thing to do by just using current IDE rules for syntax highlighting (so that you don't check style guide rules inside quotes or strings, etc) and a whole lot of regexes to enforce some really generic things.

Examples:

  • if ( rather than if(
  • checking lines with only whitespace

Are there any tools that do this kind of really generic style checking? I'd prefer it to be easily configurable for different languages (because like it or not, some things would just not work cross language) and to add new "rules" to check new things.

© Programmers or respective owner

Related posts about coding-style

Related posts about tools