Exclude files from Sonar Scan only on Merge (Pull) Requests for Code Coverage

Just looking to get insights from the community if there is a setting we can define so that on our Merge Request (Pull Request in Github lingo), certain files can be excluded?

The reason for this is that we are slowly transitioning pieces of our code (from JavaScript JS to TypeScript TS) and we’d rather have the scanning performed only on the new or updated TS files in terms of code coverage.

We still want the full level of scanning on our main branch, as that will help us prioritize which files to migrate and get advise as well on quality issues that affects the remaining files to be migrated.

I was reading this topic but have not found anything that may suffice our needs.

Thanks.

Hey there.

In the documentation you pointed to, I think Code Coverage Exclusions is what you’re looking for.

As an example, you could exclude all **/*.js files from code coverage. This will not exclude those files from other aspects of analysis, like reporting metrics and issues.