Exclude files from SonarCloud coverage calculation


The problem we’re having is that we have numerous files that do not fall under a specific naming convention (e.g. index.ts) - and some of those files have to be excluded from coverage calculations, while other files with the same name, but in different folders have to be considered for the report.

We could come up with a naming convention for our files or we could list those in ‘sonar-project.properties’, however I was just wondering if there is any other way to ‘hide’ files from being included into Coverage calculated by SonarCloud?

Ideally we are looking for a solution that does not involve changes to ‘sonar-project.properties’ file, something similar to what test engines do: e.g. adding a comment to a sourcecode file saying /* SonarCloud ignore file */ - and then SonarCloud would be ignoring the file and excluding it from a coverage report.

Hi Vlad,

Unfortunately there is no such thing as the mechanism you mentioned.

So, you need to rely on the narrowing the focus existing mechanism.


Hi Olivier,

Got it, thank you for your message.