SonarCloud coverage incorrect after stopping main branch analysis

I have a Typescript project being analysed with SonarCloud, code is in GitHub, builds happen in GitHub actions, and coverage is collected by v8. All this has been working well. We do a SonarCloud analysis as part of the build of the pull request (i.e. on the pull request branch) and we run the analysis again when the pull request is merged to develop (i.e. on the develop branch).

Recently (2 days ago) we decided to stop the SonarCloud analysis on the develop branch after merging the pull request as we feel this is redundant at that point.

However, since making that change the coverage report on our PRs is incorrect. It seems to identify incorrect lines in the coverage and the %age is way down. For example, a PR that has almost 100% coverage locally will report somewhere around 65% in SonarCloud.

I don’t see anything in the logs to suggest any problems:

INFO Analysing [/github/workspace/coverage/lcov.info]

I wondered if our New Code definition was involved - this is currently set to 30 days.
I also wondered if the fetch-depth was involved - this is set to 0 (which I believe is the whole history.

Do we need the develop branch scanned for coverage to work properly on the PR branch? They would appear to be unrelated as the coverage information should just come from the lcov file, no?

Hey there.

I suppose that you could test your theory by simply turning analysis back on for your develop branch, however I expect them to be unrelated.