SonarQube and Roslyn Rules C#

1,876 views
Skip to first unread message

Ernesto O.

unread,
Apr 6, 2017, 4:17:50 PM4/6/17
to SonarQube
Hi

I would like to ask if is there a document that show an example about the Roslyn SDK to add new rules and modify rules in C#

Best regards
Ernesto

G. Ann Campbell

unread,
Apr 7, 2017, 8:50:19 AM4/7/17
to SonarQube

Ernesto O.

unread,
Apr 7, 2017, 11:12:10 AM4/7/17
to SonarQube
Hi

Yes, I did and downloaded the Roslyn SDK, but I don't know where Can I find the existing rules to modify it, example S101 "Types should be named in camel case", How can I custom the rule ?

Best regards

G. Ann Campbell

unread,
Apr 7, 2017, 11:15:10 AM4/7/17
to Ernesto O., SonarQube
Hi Ernesto,

The idea is that you're going to write checks using Roslyn itself & then this SDK to make those Roslyn-based checks available as rules in SonarQube.


Ann 



---
G. Ann CAMPBELL | SonarSource
Product Manager

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/gO35in57oP0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/26142a2d-a261-4ba3-a3d0-8956821f84f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rasikb...@gmail.com

unread,
Apr 13, 2017, 6:35:22 AM4/13/17
to SonarQube, ernest...@gmail.com
Hi Ann,

Link doesn't describe how to write custom rules. Do you have detailed document about how to write it using sample application. I don't find on net.

Awaiting your reply.

Regards,
Rasik


On Friday, April 7, 2017 at 8:45:10 PM UTC+5:30, G. Ann Campbell wrote:
Hi Ernesto,

The idea is that you're going to write checks using Roslyn itself & then this SDK to make those Roslyn-based checks available as rules in SonarQube.


Ann 



---
G. Ann CAMPBELL | SonarSource
Product Manager

On Fri, Apr 7, 2017 at 11:12 AM, Ernesto O. <ernest...@gmail.com> wrote:
Hi

Yes, I did and downloaded the Roslyn SDK, but I don't know where Can I find the existing rules to modify it, example S101 "Types should be named in camel case", How can I custom the rule ?

Best regards


El viernes, 7 de abril de 2017, 7:50:19 (UTC-5), G. Ann Campbell escribió:
Hi,



Ann

On Thursday, 6 April 2017 16:17:50 UTC-4, Ernesto O. wrote:
Hi

I would like to ask if is there a document that show an example about the Roslyn SDK to add new rules and modify rules in C#

Best regards
Ernesto

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/gO35in57oP0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.

G. Ann Campbell

unread,
Apr 13, 2017, 6:59:32 AM4/13/17
to rasikb...@gmail.com, SonarQube, Ernesto O.
Hi Rasik,

I don't have any docs to point you to. However, it might help you to know that SonarC# is open source: https://github.com/SonarSource/sonar-csharp


Ann



---
G. Ann CAMPBELL | SonarSource
Product Manager

To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/244f855f-89df-4337-a00f-ce8cdd99b4d1%40googlegroups.com.

G. Ann Campbell

unread,
Apr 14, 2017, 7:20:57 AM4/14/17
to Rasik Bapotra, SonarQube
Hi Rasik,

Please don't forget to include the group in your replies so posterity can benefit from your wisdom.

I don't know if anyone has implemented custom rules. I only know what we've done, which is why I pointed you at the GitHub repo of SonarC#. Maybe someone from the community will chime in with pointers (which is another reason to make sure you always include the group).


Ann



---
G. Ann CAMPBELL | SonarSource
Product Manager

On Thu, Apr 13, 2017 at 9:40 PM, Rasik Bapotra <rasikb...@gmail.com> wrote:
Hi Ann,

No one has written simple custom rules using Roslyn ? I want to write custom rules to support our rules but don't know how to use SDK. Could you please put more light on this?



--
Regards,
Rasik Bapotra


Amaury Leve

unread,
Apr 18, 2017, 9:29:28 AM4/18/17
to G. Ann Campbell, Rasik Bapotra, SonarQube
Hi,

You can create custom rules using Roslyn API. The Roslyn SDK project is just there to convert your Roslyn based analyzer DLL into a jar project that is supported by SonarQube.

You can find a lot of information about creating your own analyzer with Roslyn on Google (or whatever the search engine you are using), here are some links you could use:

Cheers,
Amaury





--
Regards,
Rasik Bapotra


--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/CAEi9rUJx6Z%2BOEYUce6Q%3DxzYhJxw66piKO7KQJpSNkUt%2BVuawOg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.
--
Amaury LEVE | SonarSource
Software Developer

Tom Op

unread,
Apr 25, 2017, 3:21:07 AM4/25/17
to SonarQube
I am sending some helpfull links. Will help you with development start.

Start with Roslyn

https://github.com/dotnet/roslyn


Analyze Solution with Roslyn

https://www.codeproject.com/Articles/861548/Roslyn-Code-Analysis-in-Easy-Samples-Part


Roslyn Analyzers

http://stackoverflow.com/questions/38635/what-static-analysis-tools-are-available-for-c


TOP Packages for Roslyn !!!!

http://nugetmusthaves.com/Tag/Roslyn?page=4


Build and Deploy Libraries with Integrated Roslyn Code Analysis to NuGet

https://msdn.microsoft.com/en-us/magazine/mt573715.aspx


Create C# Roslyn commands from C# source code

http://roslynquoter.azurewebsites.net/






Dne čtvrtek 6. dubna 2017 22:17:50 UTC+2 Ernesto O. napsal(a):
Reply all
Reply to author
Forward
0 new messages