sonarqube“新代码"定义 [英] sonarqube "new code" definition

查看:159
本文介绍了sonarqube“新代码"定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是默认的质量门,奇怪的是,我们不清楚新代码"的定义!

Re the default quality gate, strangely, we are unclear of the definition "new code"!

为了说明,假设我们通过添加新代码来更改文件.默认声纳质量门分析是仅对新代码行还是整个文件进行?我们不清楚,但怀疑它是整个文件!同事告诉我,项目未能通过质量关卡,因为带有预先存在的阻止程序等的文件被触摸/更改.

To illustrate, let’s say we change a file by adding new code. Is default sonar quality gate analysis done on only the new lines of code or the whole file? We are unclear but suspect it is the whole file! I’m being told by colleagues that projects are failing quality gate because files with pre-existing blockers etc. were touched/changed.

任何澄清将不胜感激.

推荐答案

首先,分析会扫描every文件的每一行.

First, analysis will scan every line of every file.

我们说

  • 我使用的是最新版本的 SonarQube
  • 我已将泄漏期(可以在全局和项目级别配置)设置为 30 天

这意味着在过去 30 天内添加或更新的任何 代码都被视为新",因此,处于泄漏期".

That means that any line of code added or updated within the last 30 days is considered "new" and thus, "in the leak period".

如果我提交添加了错误,它会在新代码"中标记为错误.

If I make a commit that adds a bug, it's marked as a bug in "new code".

如果我更改了包含现有错误的行但不修复错误(为什么???),那么我在新"代码上有一个旧"错误.由于假设您将在编写代码时进行清理"(包括修复您正在处理的代码中的旧问题),因此没有投入任何工作来正确"处理这种情况.

If I change a line with an existing bug but don't fix the bug (Why???) then I have an "old" bug on "new" code. Since the assumption is that you'll "clean as you code" (including fixing the old issues in the code you're working on) no work has been put in to "properly" handling this case.

这篇关于sonarqube“新代码"定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆