SonarQube checks for coverage of files that are not in the coverage report

Hello,

I would like to know where does SonarQube gets the X of “Coverage on X Lines to cover”.

I am generating the coverage report with phpunit and xdebug. The xml coverage report only has UseCases from Application folder, because phpunit.xml has this:

    <coverage processUncoveredFiles="false">
        <include>
            <directory suffix="UseCase.php">./Application/</directory>
        </include>
    </coverage>

When I execute sonarscanner and check the Coverage in Sonarqube, it states that I do not have covered files from another folders, for example ./Domain/Entity/Customer.php.

Why does it check other files that are not included in the coverage report?

Thanks,
xavi

I’ve seen that you can exclude some paths with

sonar.coverage.exclusions

This is not an option, I have way many paths to include.
I would need it the other way around, just include **UseCase.php . I have tried “sonar.coverage.inclusions” with no luck.

PD: I’ve noticed I am not the only one with this problem, here it is another related post

Hi,

Welcome to the community!

You’ve encountered Executable Lines. This blog post from when we introduced the feature explains how it works. As you’ve discovered, exclusions would be what you need.

 
HTH,
Ann

Excellent, thank you very much!