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

Sonarqube: Is it possible to adapt duplication metric for javascript code?(Sonarqube:是否可以为 javascript 代码调整重复指标?)
本文介绍了Sonarqube:是否可以为 javascript 代码调整重复指标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,SonarQube 代码中 JavaScript 代码的重复指标定义如下:应该至少有 100 个连续和重复的令牌.这些令牌应该至少分布在 10 行代码中."

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."

有没有办法改变标记的数量和行数?因为我想有 5 行.

Is there a way to change the nummer of tokens and the number of lines? Since I want to have 5 lines.

推荐答案

是的,你应该把这一行放在你的 sonar-project.properties 文件中.

Yes, you should put this line in your sonar-project.properties file.

sonar.cpd.js.minimumLines=5

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

一段代码只要有至少 100 个连续和重复的令牌(可以用属性 sonar.cpd.${language}.minimumTokens) 至少分布在 10代码行(可以用​​属性覆盖sonar.cpd.${language}.minimumLines)

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)

这篇关于Sonarqube:是否可以为 javascript 代码调整重复指标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Update another component when Formik form changes(当Formik表单更改时更新另一个组件)
Formik validation isSubmitting / isValidating not getting set to true(Formik验证正在提交/isValiating未设置为True)
React Validation Max Range Using Formik(使用Formik的Reaction验证最大范围)
Validation using Yup to check string or number length(使用YUP检查字符串或数字长度的验证)
Updating initialValues prop on Formik Form does not update input value(更新Formik表单上的初始值属性不会更新输入值)
password validation with yup and formik(使用YUP和Formick进行密码验证)