How can I create my own rules for C#?

Hello Community,

since I am new, forgive me if the question has already been asked.
We have switched from NDepend to SonarQube. We are using Sonarqube 8.9.8 Version in Community Variant. Our goal is to analyze our C# codes. My questions would be as follows.

How can I create my own rules for this?
Can I import rules from NDepend to Sonarqube?
What is Roslyn analyzer, do I need it?

Hi,

Welcome to the community!

You can create your own rules, and if you do so, they’ll be written in/with Roslyn. From the docs:

Issues from third-party Roslyn analyzers (including Roslyn analyzers provided by Microsoft) are included in the MSBuild output and imported by default into SonarQube

Getting you started writing rules with Roslyn is a bit beyond the scope of this community, but if you have specific questions about getting your rule results into SonarQube, please do feel free to come back & open new threads.

 
HTH,
Ann