SonarQube code coverage percentage is not correct for PhpUnit using Clover format

Hello,

I am developing an apps with PHP in Symfony and use Behat + PhpUnit to test my code.
I have deployed SonarQube developer edition with Helm on Azure Kubernetes to scan my projects.

Each app has a bitbucket pipeline that runs on every push. The pipeline first generates coverage files from PhpUnit and Behat in clover.xml format. These files are correctly imported into SonarQube and the coverage is shown in SonarQube. So far so good.

The next step for me is to enable the quality gate on code coverage, so that PRs with low code coverage cannot be merged. This is where my challenge comes in.

For 1 project (so not for all) the code coverage in SonarQube does not match the coverage generated locally or in the pipeline.

What I have done so far:

  1. Run all test suites on develop via the Bitbucket pipeline and SonarQube

  2. Found a file where coverage does not match (56.9%)

  3. Download the Clover coverage file artifacts from the pipeline (input for SonarQube)

  4. Create Clover coverage for this single file locally on Docker setup with same image as CI

  5. Compare the 2 files with Claude code (100% on both files)

  6. Generated HTML coverage locally on Docker setup with same image as CI to verify. (100%)

This seems to happen due to function calls being spread over multiple lines.
Where the parameters on new lines in the HTML and Clover files are coloured gray (not executable so ignored in calculation) SonarQube seems to verify these lines specifically marking them red (not covered).

I cannot enable a quality gate with a 43% code coverage difference.

Could someone help me explains if I am correct, why this happens here and how to solve this?

Kind regards,

Jeroen van Dijk

Hi Jeroen,

What version of SonarQube are you seeing this in?

 
Thx,
Ann

Hi Ann,`

Thank you for your question. We are currently using. Developer Edition v10.5.1

Kind regards,

Jeroen van Dijk

Hi Jeroen,

Your version is past EOL. You should update to either the latest version or the current LTA (long-term active version) at your earliest convenience. Your update path is:

10.5.1 → 2025.1.4 → 2026.1

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

If your error persists after update, please come back to us.

 
Ann