QualInsight / qualinsight-plugins-sonarqube-smell

Code Smells plugin for SonarQube and companion Java library
GNU Lesser General Public License v3.0
47 stars 13 forks source link

.NET support #37

Open konbec opened 8 years ago

konbec commented 8 years ago

Hello, it is possible to adapt the plugin to support .NET code (C#, perhaps VB.NET) Thank You in advance!

pawlakm commented 8 years ago

Hi,

Currently the CodeSmells plugin's behavior is tightly bound to Java annotations (with SOURCE retention policy) and provides a library made available through a Maven dependency in order to help you declare these annotations correctly and make sure that only allowed Smells types are declared.

Adapting the plugin to C# / VB.NET (or any other language) should be possible, however we need to:

Once these points are handled, we'll be able to work on the plugin itself :

In any case, help will be required in order to make the plugin compatible with C# / VB.NET. If you're interested in contributing to such a new feature, do not hesitate to tell me !

simkin2004 commented 8 years ago

"Define how @Smells must be declared in C# (comments instead of annotations ? other ?)" Java annotations are roughly equivalent to .NET attributes.

"Define how and where possible Smells types are defined" https://msdn.microsoft.com/en-us/library/system.attributetargets(v=vs.110).aspx I would suspect that you want to target everything. .NET does not have the capability of targeting an attribute based on the context of the values provided. We would either need to write a special Code Smell Attribute for every code smell with the appropriate targets, and/or a generic code smell attribute that targets everything.

"Define if a violation must be raised if unexpected Smells types are used (or simply ignored)" I would include the information necessary to appropriately render the unexpected Smell as part of the Attribute definition. Then as developers created "unexpected" smells, it would show on the reports and we could add an exclusion list to the rules to filter them out or disallow unknowns.

"Decide if we need to provide a library / dependency for declaring Smells (or use comments-based declaration instead)" I believe attribute-based is more appropriate than comment-based, unless you are planning to include the smells in the documentation as well.

Could we create the .NET code scanner to match the Java version's output so that rules would not have to be rewritten?