0

我正在使用EditConfig来强制执行 2 个空格缩进。

root = true

[*]
indent_style = space
indent_size = 2
continuation_indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

我开始使用 cpplint 进行静态分析,一切正常,直到我发现某些规则与我的 EditorConfig 配置发生冲突,我正在尝试禁用此 cpplint 规则”

private: should be indented +1 space inside class
public: should be indented +1 space inside class

帮助说我可以使用过滤器来禁用特定检查,但我可以找到所有可用过滤器的列表。

Example file:
        filter=-build/include_order,+build/include_alpha

你知道我需要的过滤器的名称吗?

4

2 回答 2

0

--filter您可以在源代码cpplint.py中找到该选项的所有可用过滤器。它们是变量的一部分_ERROR_CATEGORIES。无法使用cpplint命令打印它们。

请参考cpplint.py您已安装的文件,因为您可能安装了 Google 原始版本或分叉版本。

于 2022-01-22T00:58:27.557 回答
0

解决方法很简单,我只需要仔细查看错误消息,它会在“[]”之间的消息末尾显示名称

LinuxFilesManager.hpp:7:  private: should be indented +1 space inside class LinuxFilesManager  [whitespace/indent] [3]

解决方案是像这样创建 CPPLINT.cfg 文件:

set noparent

filter=-whitespace/indent
于 2021-10-05T17:15:21.970 回答