根据一组编码标准检查 C/C++ 源代码的免费工具?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/93260/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
A free tool to check C/C++ source code against a set of coding standards?
提问by Drealmer
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.
为 Java 找到这样的工具(Checkstyle、JCSC)看起来很容易,但我似乎找不到用于 C/C++ 的工具。我不是在寻找类似于 lint 的静态代码分析器,我只想检查编码标准,如变量命名、大写、间距、标识、括号放置等。
采纳答案by yrp
回答by janesconference
Google c++lintfrom Google code style guide.
来自 Google 代码风格指南的Google c++lint。
回答by tatsuhirosatou
I'm sure this could help to some degree cxx checker. Also this tool seems to be pretty good KWStyleIt's from Kitware, the guys who develop Cmake.
我相信这在某种程度上可以帮助cxx checker。另外这个工具似乎很不错KWStyle它来自 Kitware,开发 Cmake 的人。
回答by Pieter
回答by Joshua
Try nsiqcppstyle. It's a Python based coding style checker for C/C++. It's easy to extend to add your own rules.
试试nsiqcppstyle。它是一个基于 Python 的 C/C++ 编码风格检查器。很容易扩展以添加您自己的规则。
回答by EfForEffort
There's a list. There is also a putative C++ frontend on splint.
有一个清单。在 splint 上还有一个假定的C++ 前端。
回答by EfForEffort
Check universalindentgui
on sourceforge.net.
检查universalindentgui
上sourceforge.net。
it has many style checkers for C and you can customise the checkers.
它有许多用于 C 的样式检查器,您可以自定义检查器。
回答by udpsunil
I have used a tool in my work its LDRA tool suite
我在我的工作中使用了一个工具,它的LDRA 工具套件
It is used for testing the c/c++ code but it also can check against coding standards such as MISRA etc.
它用于测试 c/c++ 代码,但也可以检查编码标准,如 MISRA 等。
回答by Wernight
回答by Andrew
Check Metrix++ http://metrixplusplus.sourceforge.net/. It may require some extensions which are specific for your needs.
检查 Metrix++ http://metrixplusplus.sourceforge.net/。它可能需要一些特定于您的需求的扩展。