which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension): 7.1
what are you trying to achieve: I want New code coverage quality check to fail even after rerun.
what have you tried so far to achieve this:
Dear all,
I have a project that has zero code coverage and is configured to have a quality gate with new code coverage > 80%. Now I run sonar analysis and it fails because new code coverage is 0. But when I rerun it with no change, it passes (because there is no new code?).
How do we handle this loop hole?
Dont call it a loop hole yet The key information missing at this stage is: what is the value of the Leak Period for this project ? (project setting in SonarQube) The Leak Period will represent from which point on is code considered New.
Thanks Nicolas. By loophole I meant loophole in our process because some people could run analysis twice to pass quality checks. . The leak period (sonar.leak.period) I see is previous_version. I guess its the default one. What is the recommended leak period? And what leak period should we use to avoid the original issue.
Thanks Colin. Our project is maven based and pom file has version 1.0-SNAPSHOT, we are not setting a new version on every build. So
Build 1: 1.0-SNAPSHOT
Build 2: 1.0-SNAPSHOT
Shouldn’t previous_version work in this case? Also I am bit confused about different leak periods, is there an elaborate explanation somewhere?
Can you check the “Activity” tab of your project? Is it showing a new version entry for every analysis? Let us know if there’s anything interesting in there.
The details in the General settings of a project’s administration tab for sonar.leak.period is the best documentation I know for valid leak period settings.
I am now trying to reproduce my issue now and can’t. Not sure what happened few days back, before my holidays. History logs in CI are also gone so don’t have much information. May be I should go for holidays more often
I am using Java. I will come up with more information if I see the issue again.