Sonarqube:是否可以为 javascript 代码调整重复指标?

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

目前,SonarQube 代码中 JavaScript 代码的重复指标定义如下: “应该至少有 100 个连续且重复的标记。 这些代币应该至少分布在 10 行代码上。”

有没有办法改变令牌的数量和行数?因为我想要 5 行。

是的,您应该将此行放入声纳-project.properties 文件中。

sonar.cpd.js.minimumLines=5

参见https://docs.sonarqube.org/display/SONAR/Analysis+Parameters#AnalysisParameters-Duplications

A piece of code is considered as 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)