目标:
代码符合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工具:

详细参数:
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快捷键。

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

网友评论