SonarQube:在合并到主分支之前检查Java代码块重复性。

huangapple go评论75阅读模式
英文:

SonarQube: check for Java code block duplications even before merging to master

问题

我们正在使用 SonarQube 开发者版本 8.2(构建 32929)来分析我们的 Java 项目,并且将重复代码的度量传递进来,测试覆盖率设置为 x%。现在对于一个 Git 拉取请求,实际度量值低于设定的阈值,Jenkins 构建顺利进行。但是在合并到主分支后,它会针对整个代码重新检查相同的度量标准,构建显然会失败。

我正在寻找一种方法,在拉取请求本身中就可以针对整个主分支的代码进行可能的重复、覆盖率等方面的检查,提前而不是等到合并后的构建失败才感到惊讶。

对任何想法表示感谢。谢谢。

英文:

We are using SonarQube Developer Edition Version 8.2 (build 32929) for our Java project and passing metric for duplication, test coverage is set at x%. Now for a git pull request actual metric is below this set limit, the jenkins build goes fine. But after merging into master, it is checking for the same metric against the entire code and build apparently fails.

I am looking for a way to check my code in the pull request itself against the entire master branch for possible duplications, coverage, etc. way in advance and not wait for a surprise until my build fails after merging.

Any ideas are appreciated. Thank you.

答案1

得分: 0

你可以在你的集成开发环境中添加 SonarLint 插件,在提交你的本地变更之前进行验证。这将有助于在提交之前修复错误。

英文:

You can add sonarlint plugin in your IDE and verify it before committing your changes in local. It would help to fix bugs before commit.

答案2

得分: 0

我同意上一个答案。
如果您有一个大项目,您可以通过SonarLint插件验证所有修改过的文件。

英文:

I agree whit the last answer.
If you have a big project, you can verify all modified files by sonarlint plugin.

huangapple
  • 本文由 发表于 2020年9月11日 08:42:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/63839354.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定