如何忽略 Sonar 中生成的代码?

How can I ignore generated code in Sonar?

我想忽略生成的 Java 源代码文件。不是按文件名或模块名,而是按文件本身中的某些 "signal text"。例如。当源代码文件包含 comment/line 表示

/**
* This file was auto-generated from WSDL
* by the IBM Web services WSDL2Java emitter.
* cf10631.06 v81706232132
*/

更好的方法是将此类文件的所有代码行都计为生成的代码行数。

目前只找到this article

有什么想法可以解决这个问题吗?任何指针表示赞赏。

这目前是不可能的。您可以关注并投票给https://jira.sonarsource.com/browse/SONAR-4972

编辑:问题已关闭 "Won't fix" 作为 "the effort is to be done on each language plugin".

目前,您只能忽略生成文件的问题:http://docs.sonarqube.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-IgnoreIssues