开发者

Automated Coding Standard Violation Detection for C++

What I want to do is to have a tool run by my CI server to scan the code and detect any coding standard violations present based on a defined guideline. I will use the output to prompt build "fails" until the issue is fixed.

The problem I have is that my engineers are spending most of their time in code reviews looking for coding standards violations and not looking for bugs (70-76% of defects found are standards related). My theory is if they don't need to look for viol开发者_如何学运维ations of standards they will branch out as to what they are looking for.

Does anything like this exist?


What you want is called static analysis

2 of them are free :

cppcheck — Open-source tool that checks for several types of errors, including use of STL. cpplint Open source, automated checker to make sure a C++ file follows Google's C++ style.

Then some comercial compilers include static analysis : Visual Studio (Team system and above) Intel compiler (I've heard it's very customizable, but I haven't personally used it yet)


If issues related to code formatting - you can enforce invocation of code beautifiers on checkin to repository (astyle, indent, ...)

Next one is PC-lint/Flexelint tool, which also has rules to enforce various coding standard guidelines. But it is non-free. You have to familiarize with it and configure it properly to avoid false positives.

You also can check Vera++, but I've no experience with it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜