views:

200

answers:

2

I have a pretty new code base written in C++. Already I'm starting to see some bad practices creeping into the project (class file with 1000+ lines of code, functions with a lot of parameters, ...).

I would like to stop on these right away with some automated tools which can hook into the build and check for poor coding practices. What suggestions do you have for such tools? I'm interested in metrics but really more interested in a stylistic sort of lint which would highlight functions with 37 parameters.

+1  A: 

I'm sorry I can't help you with respect to style, but a great metrics tool which supports C++ and is free is SourceMonitor:

http://www.campwoodsw.com/sourcemonitor.html

In particular, you will get good info like Cyclomatic Complexity (which I find of more value for bad programming practice than # of parameters), as well as LOC, % Comments, Longest function, etc...

Give it a try -- and it is very fast as well.

torial
A: 

Make sure that you always compile with -Wall compiler option and make it practice that no code is to be checked in if warnings persist.

Find a standard style to follow like: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml

ddcruver