我点击了下面的 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/