java - Sonar 中的重复标准

标签 java sonarqube sonar-runner sonarqube5.1

我点击了下面的 Java 脚本链接

Sonarqube: Is it possible to adapt duplication metric for javascript code?

我也为我的 Java 项目做了类似的事情。 据此,如果我们希望更改重复标准,即默认 10 行,我们必须在存储在项目中的 sonar.properties 文件中添加一行。

sonar.projectKey=Test
sonar.projectName=Test
sonar.projectVersion=1.0
sonar.sources=src
sonar.language=java
sonar.sourceEncoding=UTF-8
sonar.cpd.java.minimumLines=5 

但是它不适用于 Java,我还需要配置什么吗?

最佳答案

SonarQube's Duplications documentation :

A piece of code is considered duplicated as soon as there are at least 100 successive and duplicated tokens (can be overridden with property sonar.cpd.${language}.minimumTokens) spread on at least 10 lines of code (can be overridden with property sonar.cpd.${language}.minimumLines). For Java projects, the duplication detection mechanism behaves slightly differently. A piece of code is considered as duplicated as soon as there is the same sequence of 10 successive statements whatever the number of tokens and lines. This threshold cannot be overridden.

关于java - Sonar 中的重复标准,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41439789/

相关文章:

java - Sonar 扫描仪不支持的 major.minor 版本异常

maven - Sonar 未导入coverage.xml结果

java - 如何使用 openJPA 自动检测实体?

java - 如何在 Spring Security 3 的用户登录中添加一些自己的逻辑

java - 识别 "click-point"和 JfreeChart 图中单击的子图时出现问题

maven - 在 Maven 项目中分析 TypeScript SonarQube

java - SonarQube 提示 : Either log or rethrow this exception

sonarqube -/batch/project (SonarQube 4.5) 读取超时

java - 如何在我的本地框中登录 SonarQube

java - 为 Void 方法创建 Junit 测试