Quality Gate is Passing When it is Expected to Fail


I am configuring a pull-request analysis using Bitbucket Pipelines. I got everything working and then to test the gate would fail I added a new source code without any test coverage. The panel on the PR correctly shows that there is no coverage on the new file, but the sonarcloud-quality-gate:0.1.6 shows the Quality Gate Passed.

I went and checked which quality gate was configured for this repo. It was the default Sonar Way quality gate. I change that to a quality gate that requires 100% coverage and ran the pipeline again. The quality gate continues to pass.

How do I verify which quality gate is being used by sonarcloud-quality-gate:0.1.6? Is there a way to get more verbose output from sonarcloud-quality-gate:0.1.6 similar to the scanner? I added:

          - pipe: sonarsource/sonarcloud-scan:2.0.0
          - pipe: sonarsource/sonarcloud-quality-gate:0.1.6
              DEBUG: "true"

which is what I do to make the scanner more verbose, but it doesn’t seem to work for the quality-gate.

This is a new repo. Is it possible that this is what I’m experiencing?

When a project is first imported into SonarCloud and analyzed by automatic analysis the first analysis behaves differently from subsequent analyses.

I figured out what the problem was.

The analysis scope defined in our sonar-project.properties file was incorrect. This repo has a similar structure to what is described in the example in the exclusion and inclusion section on the Analysis Scope page in the docs.

Everything is working as expected now.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.