自动的C ++代码风格指南测试 [英] automatic code-style-guide test for C++

查看:53
本文介绍了自动的C ++代码风格指南测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

我正在启动一个c ++项目,涉及几个我没有直接联系的人。我们就编码风格指南达成了一致,例如定义班级成员的大小写,具体取决于可访问性(例如,在pascal情况下为私人,在骆驼情况下为公众和受保护者。请不要开始讨论样式指南。我受够了。谢谢。)。

I am starting a c++ project involving several people I have no direct access to. We agreed on a coding style guide, which e.g. defines the casing for class members depending on the accessibility (i.e. privates in pascal case, publics and protecteds in camel case. Please, don't start discussions about the style guide. I had enough. Thank you.).

我现在要做的是生成一些违反样式指南的报告。我不想执行样式指南,例如在提交时,但我想提供一个工具,每个开发人员都可以使用该工具来查看他/她的代码在何处违反了样式指南(如果他/她想对其进行检查)。

What I want to do now is to generate some reporting of style guide violations. I don't want to enforce the style guide, e.g. at commit, but I want to provide a tool which each developer can use to see where his/her code violates the style guide (if he/she wants to check it).

您知道一个可以胜任这项工作的工具吗?

Do you know a tool which can do the Job?

(它需要能够理解某些C ++,例如,检测类成员的可访问性。)

(It needs to be able to understand some C++, e.g. to detect the accessibility of class members.)

推荐答案

我已经成功使用 vera ++ 工具为我们的项目执行此操作。我已经编写了许多规则(在TCL中)以采用我们的公司风格准则。直到我发现支票上报告的所有误报之前,这有点痛苦。至少现在它运行良好,我已经将报告集成到Jenkins构建分析中。

I've been successfully using the vera++ tool to do this for our projects. I've wrote a number of rules (in TCL) to adopt our company style guidelines. It was a bit painful, until I came around all the false positives reported from my checks. At least it's working well now and I have integrated the reports to the Jenkins build analysis.

这些报告还可以轻松地用于Eclipse IDE中的自定义错误分析。

The reports can also be easily adopted to a custom error analysis in the Eclipse IDE.

这篇关于自动的C ++代码风格指南测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆