美文网首页
win下VS2015代码风格检查

win下VS2015代码风格检查

作者: Optimization | 来源:发表于2020-05-20 20:49 被阅读0次

目标:

代码符合Google C++ Style Guide。

正文:

1.可以使用Cpplint进行代码风格检测。Cpplint使用Python,所以要先安装Python。然后将cpplint clone下来:

git clone https://github.com/google/styleguide

2.接着,将cpplint集成到VS内部
在Tools->External Tools内,添加cpplint工具:


image.png

详细参数:

 C:\styleguide-gh-pages\cpplint\cpplint.py --output=vs7 --filter=-build/c++11,-build/include_order,-runtime/threadsafe_fn,-runtime/references --root=include $(ItemPath)

3.为了使用方便,还可配置cpplint快捷键。


image.png

在Tools->Options的Keyboard选项里添加快捷键设置。在快捷键配置中,搜索external(中文版搜索“外部”),
并设置Tools.External.CommandX(X为cpplint在external tools中的排序),并配置快捷键。
4.TABLE和空格切换


image.png

相关文章

网友评论

      本文标题:win下VS2015代码风格检查

      本文链接:https://www.haomeiwen.com/subject/srkoohtx.html