Does SonarCloud honor a Runsettings file's exclusions?

Are there any conventions required to use it? I dont want to use or encourage [ExcludeFromCodeCoverage] by everyone because its easy to misapply or abuse.

I cant find much info, and what I can find is dated and conflicting.

Hello @StingyJack,

Generally speaking SonarCloud and SonarQube are thought with trust in developers mindset.
Now I can understand your worry. If you have control on your pipeline (but no control on the SCM where some settings can be stored in scanner configuration files), you can still override the config file by adding the “dangerous” properties with empty values on the scanner command line.

If you give me a bit more context on you scanning environment, we could look at more subtle solutions.

:christmas_tree: Merry Christmas :christmas_tree:

@OlivierK - Sorry, but I dont think you get my meaning.

MSTest has always honored a runsettings file (used to be testsettings) that contains things to exclude from code coverage. Its the same as the ExcludeFromCodeCoverage attribute but doesnt require littering the codebase with the attribute. There is more info about this in a similar request at https://github.com/SonarSource/sonar-dotnet/issues/1487, but I dont know if that responder can really speak for SonarCloud. Can you “officially” answer if the runsettings file is going to be honored or not, and if so, what I have to do to use it?

I’d like to know asap if I have to add possibly several dozen (or hundreds of) attributes to the code or if I can include a single runsettings file.

I would also like to know if the coverage analysis is going to skip analysis for things with the System.CodeDom.Compiler.GeneratedCodeAttribute. Can you officially answer that?

Hello @StingyJack,

Best wishes for 2021 !

Indeed I did not understand your point (because I am not so familiar with the .Net world). This is clear now.
I think that you have all the most up to date status on https://github.com/SonarSource/sonar-dotnet/issues/1487 so I believe there’s no point in continuing the discussion in the this thread. We’ll only duplicate what’s discussed in that GitHub issue.

Olivier