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. Those tokens should be spread at least on 10 lines of code.”
Is there a way to change the nummer of tokens and the number of lines? Since I want to have 5 lines.
Yes, you should put this line in your sonar-project.properties file.
sonar.cpd.js.minimumLines=5
See 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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.