简体   繁体   English

Sonarqube:是否可以针对JavaScript代码调整复制指标?

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

At the moment the duplication metric for JavaScript Code in SonarQube code is defined as followed: “There should be at least 100 successive and duplicated tokens. 目前,SonarQube代码中JavaScript代码的重复度量定义如下: “应该至少有100个连续和重复的令牌。 Those tokens should be spread at least on 10 lines of code.” 这些令牌至少应分布在10行代码上。”

Is there a way to change the nummer of tokens and the number of lines? 有没有办法改变令牌数量和行数? Since I want to have 5 lines. 由于我想有5行。

Yes, you should put this line in your sonar-project.properties file. 是的,您应该将此行放在sonar-project.properties文件中。

sonar.cpd.js.minimumLines=5

See https://docs.sonarqube.org/display/SONAR/Analysis+Parameters#AnalysisParameters-Duplications : 参见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) 只要至少有10行代码(可以使用覆盖),则至少有100个连续和重复的标记(可以被属性sonar.cpd。$ {language} .minimumTokens覆盖)被视为重复。属性sonar.cpd。$ {language} .minimumLines)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM