Custom Rules for C# As of Oct 2018


(Bogus) #1

Hi,

What is the best way to write custom rules for C# as of Oct 2018?

I have read this:
https://docs.sonarqube.org/display/DEV/Adding+Coding+Rules
and this

The Roslyn SDK seems to be out of date as of https://jira.sonarsource.com/browse/MMF-1332.
However, the documentation on MMF-1332 doesn’t seem to make it super clear how to do this as of now.

Any help would be appreciated.


(Amaury Levé) #2

Hi @BogusDude,

We have started to deprecate the SonarQube Roslyn SDK product because we are working on providing an easier way to integrate other Roslyn analyzers with SonarQube/SonarCloud.

The best/recommended way currently depends upon your use case:

  • You care about the debt associated to the issues. In this case you need to keep using the SonarQube Roslyn SDK.

  • You don’t. If you target SonarQube 7.4 or SonarCloud and you are using SonarC# 7.6+ or SonarVB 7.6+ and the Scanner for MSBuild 4.4+, all roslyn issues are now automatically imported. So if you have your analyzer added to your projects and raising issues they will show up in the server without any requirement from you.

Hope that answers your question.

Cheers,
Amaury