Custom plugin for Csharp language

Hello,

I want to create a new custom CSharp plugin with some specific rules.
I would want to analyze code with a framework that could use AST.

I already work on custom plugin for Python, PHP and Java and for each there is libraries that we can use to analyse code with AST. I’m a core-contributor of “ecoCode-java”, “ecoCode-python” and “ecoCode-php” plugins (you can find them here : Green Code Initiative · GitHub )

I tried this one Maven Central: org.sonarsource.dotnet:sonar-csharp-plugin but I didn’t find an API to use AST.
For Java, we have Maven Central: org.sonarsource.java:sonar-java-plugin
For PHP, we have Maven Central: org.sonarsource.java:sonar-php-plugin
For Python, we have Maven Central: org.sonarsource.java:sonar-python-plugin
Each one of them have an APi to use AST, but not Csharp plugin.

Do you think it already exits for Csharp and if yes, can you give me a github project example ?

Thank you a lot.

regards.
David

Hey there.

There’s no particular API for writing custom rules for C# – we suggest writing custom roslyn analyzers which can, if necessary, be bundled and provided as a plugin using the GitHub - SonarSource/sonarqube-roslyn-sdk: SDK for SonarQube Roslyn Analyzer Plugins.

1 Like

Hi @Colin,

ok. thank you for answer. I will check it.

regards.
David.