Quality Gate set at 5 minors issues, but an error being thrown with 1 minor issue

(RW) #1

We have our Quality Gates set to pass at 5 minor issues or less and currently we have only one minor issue and the scan is failing. Any ideas?

Anyone know how SonarQube configures the code smell threshold?

SonarQube Version 6.7.5

{“status”:“ERROR”,“metricKey”:“code_smells”,“comparator”:“GT”,“errorThreshold”:“0”,“actualValue”:“1”}

2 Likes
(G Ann Campbell) #2

Hi,

How about a screenshot of your Quality Gate?

 
Ann

(Edwin Yu Makiuchi) #3

Hi Ann,

Please find the screenshot below:

Thanks,
Edwin

(RW) #4

(G Ann Campbell) #5

Hi,

The JSON snippet from the first post in this thread is about

“metricKey”:“code_smells”

but Code Smells don’t appear in your screenshot. At a guess, you have multiple Quality Gates configured, and a different QG than you think is being applied to your project.

 
Ann

(Edwin Yu Makiuchi) #6

Ann,

The command output seems to be pointing to the correct quality gate:

Can you let us know how we can investigate if a different quality gate is overwriting the one shown in the screenshot?

Thanks,
Edwin

(G Ann Campbell) #7

Hi Edwin,

Your log shows that the DFW CICD Quality Way profile is being used (for Java). The selection of a profile has nothing to do with the selection of the quality gate, similarly named or not. To know for certain which quality gate was applied on your last analysis, look at the bottom-right of the project homepage:

Selection_322

 
HTH,
Ann

(Edwin Yu Makiuchi) #8

Hi Ann,

The project homapge shows that the DFW CICD Quality Gates was applied:

sonarqube-project-homepage

Thanks,
Edwin

(G Ann Campbell) #9

Hi Edwin,

I’ll admit, I’m stumped. Can I have a screenshot of the failing Quality Gate from the project homepage?
Selection_323

 
Ann

Edit: Also, where exactly did you get that original snippet of JSON?

(Edwin Yu Makiuchi) #10

Hi Ann,

The project homepage indicates that the Quality Gate has passed for the master branch;
however, the feature branch in question indicates that there is one minor issue.

The JSON snippet is retrieved by calling the project_status API by passing in the analysisId.
The analysisId is retrieved from the maven command that is used to check if the project passed the quality gate.

Unfortunately, I can only include one screenshot per post;
please take a look at the image below regarding the screenshots of the quality gate and how the JSON snippet was populated:

Thanks,
Edwin

(G Ann Campbell) #11

Hi Edwin,

Thanks for the screenshots. Now I understand what’s going on. There is currently a hard-coded Quality Gate(QG) for PRs and Short-Lived Branches (SLBs): no open issues. Your SLB is failing the QG because it fails that test. You can Confirm the issue if you’d like the SLB to pass the QG with that single issue.

SonarQube 7.7 will include real QGs for PRs and SLBs.

 
Ann

1 Like
(Edwin Yu Makiuchi) #12

Thank you for the clarification, Ann.

Best regards,
Edwin