6

我想在我的整个项目上运行cpplint.py而不是单个文件来获取项目中所有 C/C++ 文件的报告。如何在 macOS 和 Windows 上执行此操作?

4

3 回答 3

4

我刚刚在这篇很棒的帖子下找到了部分问题的答案

“Shell Foo:获取所有项目源文件的 cpplint 故障报告”

这是如何在 Mac 上为项目运行 cpplint 的方法

.python cpplint.py --linelength=120 --counting=detailed $( find .-name *.h -or -name *.cc | grep -vE "^./build/" )

对于 Windows,有一篇关于 Visual Studio 集成的文章。 如何将 cpplint.py 集成到 Visual Studio

于 2015-07-09T05:29:17.570 回答
4

我使用的是 Ubuntu,所以我的经验仅供参考。

./cpplint.py ~/projects/* ~/projects/*/*
# or you can:
./cpplint.py ~/projects/*.* ~/projects/*/*.*
于 2016-09-01T06:48:14.327 回答
2

如果你想递归地对所有文件夹执行 cpplint,在 Ubuntu 中你可以使用:

find FOLDER_PATH -iname *.h -iname *.cpp | xargs cpplint

项目文件夹的相对路径或完整路径在哪里FOLDER_PATH,您还可以按名称或扩展名指定要检查的文件,并且可以根据需要多次连接,

find FOLDER_PATH -iname *.h  -iname *.cpp -iname *.java

就我而言,我在我的项目文件夹中运行 cpplint 并且我想检查 src 文件夹,所以对我来说它是

find ./src -iname *.h  -iname *.cc | xargs cpplint
于 2020-07-21T09:11:34.130 回答