Best way to import a c# project with existing rules into SonarCloud

I have a c# project which has been using Sonar Analyser stand-alone in visual studio for some time and has .ruleset files that configure the analyser to override the default rules. It is built in Azure devops with CI/CD pipelines.

Having recently imported the project into Sonar Cloud and added the steps to the CI/CD pipelines as per the instructions in the tutorials, I find the .ruleset files are no longer overriding the default quality profile and so I got a lot of unwanted warnings at compilation time.

My first thought was to derive a profile from the default and make the changes there, but it turns out you can only turn on more rules or change the priority of existing ones, you can’t turn off rules in the derived profile that are turned on in the profile it inherits from.

I don’t like the look of cloning the default profile and editing the clone as it means over time the project profile will drift from the company defaults in other areas than those overridden in the .ruleset files, and it is tedious to edit them one at a time.

Is there any way of using the .ruleset files for the project in Sonar Cloud when compiling in dev ops, or of importing them into a sonar cloud rule configuration for the project?

Hi,

I’ve moved this to the Product Manager for a Day subcategory because, unfortunately, the functionality doesn’t exist.

And I’ll ping the full-time PM to make sure he sees this.

 
Ann