0

I'm using SonarQube 5.4 and I noticed that when a metric, which is used to calculate the Quality Gate status, is missing then that is handled in the same way as if the criteria was met.

Isn't it more intuitive that the Quality Gate fails if there is missing information to determine the status? Or at least that it is configurable to fail by default if there is missing data?

G. Ann - SonarSource Team
  • 22,346
  • 4
  • 40
  • 76
Alix
  • 2,630
  • 30
  • 72
  • Do you have an example ? Which metric are you using ? – Julien L. - SonarSource Team Sep 16 '16 at 14:49
  • Code coverage. I have a condition in the quality gate requiring att least x % code coverage and the project does not report any but still passes – Alix Sep 16 '16 at 14:51
  • Then you should always have coverage. In which situation is it possible to not compute coverage ? – Julien L. - SonarSource Team Sep 16 '16 at 14:52
  • Let's say you've set up a new project in a language where it's difficult to gather code coverage or if the code coverage plugin (jacoco) fails to report any data. Or if some someone breaks the config. In any such event it would be good if the problem is highlighted – Alix Sep 16 '16 at 14:53
  • I understand, but then it has nothing to do with the quality gate. For me, it's the analysis that should fail if something goes wrong (Jacoco fails to gather coverage data, etc.). – Julien L. - SonarSource Team Sep 16 '16 at 14:57
  • So you're saying that a project that has not set up code coverage is incompatible with SonarQube? – Alix Sep 16 '16 at 14:58
  • No, but it's not up to SonarQube to detect if analysis is not done like you want – Julien L. - SonarSource Team Sep 16 '16 at 15:07
  • Ok. But wouldn't it make more sense if SonarQube fails analysis in that case since the quality gate status cannot be computed properly? – Alix Sep 16 '16 at 15:10
  • I'm not sure this is easy, as for instance you could need to disable coverage because you have a configuration issue, and you don't necessarily want to have the compute engine task failing because of that – Julien L. - SonarSource Team Sep 19 '16 at 10:09

1 Answers1

1

Instead of having the quality gate able to deal with a missing code coverage measure our goal is to find a standard way to force coverage to 0 when there is no coverage information available for one source file. This is not an easy subject but this is something that we'll try to fix part of https://jira.sonarsource.com/browse/MMF-345.