是否有 Cppcheck 消息列表?
Is there a list of Cppcheck messages?
我们的团队以前使用 Lint 作为静态代码分析器,但它变得太杂乱且噪音太大。
我们正在使用 C++03 并经常使用 Boost, and Lint didn't seem to like Boost (I hear this has become better in later versions). I started looking at other static code analysers and came across Cppcheck 并进行了试用。它的警告给我留下了深刻的印象(我已经看到了十几个信息和样式问题)。
我感兴趣的是:是否有一个Cppcheck发出的所有Cppcheck消息的列表,类似于how Lint and PVS-Studio both have a list of their messages? The official Cppcheck website列表:
- 越界检查
- 内存泄漏检查
- 检测可能的空指针取消引用
- 检查未初始化的变量
- 检查 STL 的无效使用
- 检查异常安全
- 如果使用了过时或不安全的函数,则发出警告
- 关于未使用或冗余代码的警告
- 检测各种指示错误的可疑代码
- …
但我对类似于 Lint 和 PVS-Studio 的东西更感兴趣,并且类似于 Visual Studio:
中结果的显示方式
ID | Category/Severity | Text
Cppcheck 检查列表可用 at the project's wiki,如此处所述,您还可以通过 运行:
从命令行获取列表
$ cppcheck --doc
或
$ cppcheck --errorlist
错误列表输出一个 XML 文件,其中包含您想要的所有三样东西。这是其中的一个小例子:
<error id="unnecessaryForwardDeclaration" severity="style" msg="The variable 'name' forward declaration is unnecessary. Type variable is already declared earlier."/>
<error id="variableHidingEnum" severity="style" msg="variable 'name' hides enumerator with same name"/>
<error id="unnecessaryQualification" severity="style" msg="The extra qualification 'type' is unnecessary and is considered an error by many compilers."/>
我们的团队以前使用 Lint 作为静态代码分析器,但它变得太杂乱且噪音太大。
我们正在使用 C++03 并经常使用 Boost, and Lint didn't seem to like Boost (I hear this has become better in later versions). I started looking at other static code analysers and came across Cppcheck 并进行了试用。它的警告给我留下了深刻的印象(我已经看到了十几个信息和样式问题)。
我感兴趣的是:是否有一个Cppcheck发出的所有Cppcheck消息的列表,类似于how Lint and PVS-Studio both have a list of their messages? The official Cppcheck website列表:
- 越界检查
- 内存泄漏检查
- 检测可能的空指针取消引用
- 检查未初始化的变量
- 检查 STL 的无效使用
- 检查异常安全
- 如果使用了过时或不安全的函数,则发出警告
- 关于未使用或冗余代码的警告
- 检测各种指示错误的可疑代码
- …
但我对类似于 Lint 和 PVS-Studio 的东西更感兴趣,并且类似于 Visual Studio:
中结果的显示方式ID | Category/Severity | Text
Cppcheck 检查列表可用 at the project's wiki,如此处所述,您还可以通过 运行:
从命令行获取列表$ cppcheck --doc
或
$ cppcheck --errorlist
错误列表输出一个 XML 文件,其中包含您想要的所有三样东西。这是其中的一个小例子:
<error id="unnecessaryForwardDeclaration" severity="style" msg="The variable 'name' forward declaration is unnecessary. Type variable is already declared earlier."/>
<error id="variableHidingEnum" severity="style" msg="variable 'name' hides enumerator with same name"/>
<error id="unnecessaryQualification" severity="style" msg="The extra qualification 'type' is unnecessary and is considered an error by many compilers."/>