Create Custom Rules for C# in SonarCloud

(Minesh Rathod) #1

i want to write custom rules for C# in SonarCloud, so need help on how can we create the rule and add in SonarCloud rule list and applies for our project

i tried to navigate on SonarCloud portal but did find place to do so

Support Custom plugin on Sonar Cloud
(Antoine Vigneau) #2

Hello @mineshrathod-gep,

SonarCloud is a cloud service, so it is not possible to inject custom rules for your own use.

However using SonarQube you can consider writing a custom plugin with custom rules. You can have a look to our extension guide in order to figure out how to proceed. Note that there are also community plugins, maybe other user have the same need than you have.

I hope this helps.


SonarCloud report and custom rule
(Duncan Pocklington) #3

As said above, you can’t add custom rules to SonarCloud. However, if your project includes any third-party Roslyn analyzers, then any issues raised by will be reported in SonarCloud as generic issues.

This will happen automatically as long as you are using version 4.4 or later of the Scanner for MSBuild. See here for more info.

Generic issues have a few limited described in the link above e.g. you can’ use the SonarCloud UI to configure the set of rules that are run.