A free tool to check C/C++ source code against a set of coding standards?

C++CCoding Style

C++ Problem Overview


It looks quite easy to find such a tool for Java (Checkstyle, JCSC), but I can't seem to find one for C/C++. I am not looking for a lint-like static code analyzer, I only would like to check against coding standards like variable naming, capitalization, spacing, identation, bracket placement, and so on.

C++ Solutions


Solution 1 - C++

The only tool I know is Vera. Haven't used it, though, so can't comment how viable it is. Demo looks promising.

Solution 2 - C++

Solution 3 - C++

I'm sure this could help to some degree cxx checker. Also this tool seems to be pretty good KWStyle It's from Kitware, the guys who develop Cmake.

Solution 4 - C++

Not exactly what you ask for, but I've found it easier to just all agree on a coding standard astyle can generate and then automate the process.

Solution 5 - C++

Try nsiqcppstyle. It's a Python based coding style checker for C/C++. It's easy to extend to add your own rules.

Solution 6 - C++

There's a list. There is also a putative C++ frontend on splint.

Solution 7 - C++

I have used a tool in my work its LDRA tool suite

It is used for testing the c/c++ code but it also can check against coding standards such as MISRA etc.

Solution 8 - C++

Check universalindentgui on sourceforge.net.

it has many style checkers for C and you can customise the checkers.

Solution 9 - C++

There is cppcheck which is supported also by Hudson via the plugin of the same name.

Solution 10 - C++

Check Metrix++ http://metrixplusplus.sourceforge.net/. It may require some extensions which are specific for your needs.

Solution 11 - C++

Check out Abraxas Code Check http://www.abxsoft.com/codchk_user.html

Solution 12 - C++

I'm currently working on a project with another project to write just such a tool. I looked at other static code analysis tools and decided that I could do better.

Unfortunately, the project is not yet ready to be used without fairly intimate knowledge of the code (read: it's buggy as all hell). However, we're moving fairly quickly, and hope to have a beta release within the next 8 weeks.

The project is open source - you can visit the project page, and if you want to get involved, we'd love some more external input.

I won't bore you with the details - you can visit the project page for that, but I will say one thing: Most static code analysis tools are aimed at checking your code for mistakes, and not very concerned with checking for coding guidelines. We have taken a more flexible approach that allows us to write plugiins to check for both "house rules" as well as possible bugs.

If you want any more information, please don't hesitate to contact me.

Cheers,

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDrealmerView Question on Stackoverflow
Solution 1 - C++yrpView Answer on Stackoverflow
Solution 2 - C++janesconferenceView Answer on Stackoverflow
Solution 3 - C++tatsuhirosatouView Answer on Stackoverflow
Solution 4 - C++PieterView Answer on Stackoverflow
Solution 5 - C++JoshuaView Answer on Stackoverflow
Solution 6 - C++EfForEffortView Answer on Stackoverflow
Solution 7 - C++udpsunilView Answer on Stackoverflow
Solution 8 - C++Ajay WazirView Answer on Stackoverflow
Solution 9 - C++WernightView Answer on Stackoverflow
Solution 10 - C++AndrewView Answer on Stackoverflow
Solution 11 - C++Tim ChildView Answer on Stackoverflow
Solution 12 - C++ThomiView Answer on Stackoverflow