C# plugin how to import and export fxcop and stylecop rules?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

C# plugin how to import and export fxcop and stylecop rules?

Vincent Labatut
Hi,

I need to import my sonar ruleset (.ruleset files) into my quality profile in SonarQube.

The option to load a ruleset when creating a quality profile has disappeared with C# v3 plugin. After some research I found nothing related to that subject.
Same issue for stylecop (.StyleCop files) rules.

1/ Is there any plan for adding back those options?
2/ Regarding the export, the permalinks for FxCop and Stylecop disappeared as well. Any plans to reimplement them ?


For exporting, at worse, we can still write a small tool in order to transform Sonar rules into proper .StyleCop and .ruleset files.

For importing, it looks important to my eyes that sonar supports such a feature. I'd like Sonar to support round-tripping with fxcop and stylecop rules (just like FindBugs)
Any workaround for importing existing rules with the current version?

Well done with all the work on C# so far, even if I have major regressions in my SonarQube system, I can't upgrade yet to C# 3, our whole sonar instance is quite late now (v4.1.1) !
Keep up the good work !

Regards,
Vincent






Reply | Threaded
Open this post in threaded view
|

Re: C# plugin how to import and export fxcop and stylecop rules?

Dinesh Bolkensteyn-2
Hi Vincent,

I agree that the export from SonarQube to FxCop / StyleCop should be much easier to implement as the import.
The export is probably already coded in the plugin (as we need to generate the config files prior to running the tool) - it's only not exposed via the "export" feature within SonarQube.
So I'll split the Jira tickets, to allow at least for independent implementation of the export and the import features:

Export:

Import:

Regarding the import from StyleCop, there were some investigations done recently Arnaud Sylvestre.
It seems that StyleCop will run many rules by default, even if they are not explicitly present in the .StyleCop file.
Hence, it is hard to get the exhaustive list of rules to enable in SonarQube: it would require a tool written in C# itself
Therefore that ticket has been closed as Won't Fix.

Could you clarify why those tickets are blocker for you?

In my mind:

Export: The FxCop / StyleCop tools are executed by SonarQube itself during the analysis. I see the export option useful only in a scenario where you want to allow developers to run those tools locally with the same config as in SonarQube.

Import: It would save the SonarQube administrator the initial effort to configure the quality profile. This should be a one time 1 hour effort. If you are on C# 2.1, and your quality profile is already properly configured, then it will remain so after an upgrade to 3.x, so there is even no effort at all.

Kind regards,



On Wed, Dec 3, 2014 at 4:23 PM, Vincent Labatut <[hidden email]> wrote:
Hi,

I need to import my sonar ruleset (.ruleset files) into my quality profile in SonarQube.

The option to load a ruleset when creating a quality profile has disappeared with C# v3 plugin. After some research I found nothing related to that subject.
Same issue for stylecop (.StyleCop files) rules.

1/ Is there any plan for adding back those options?
2/ Regarding the export, the permalinks for FxCop and Stylecop disappeared as well. Any plans to reimplement them ?


For exporting, at worse, we can still write a small tool in order to transform Sonar rules into proper .StyleCop and .ruleset files.

For importing, it looks important to my eyes that sonar supports such a feature. I'd like Sonar to support round-tripping with fxcop and stylecop rules (just like FindBugs)
Any workaround for importing existing rules with the current version?

Well done with all the work on C# so far, even if I have major regressions in my SonarQube system, I can't upgrade yet to C# 3, our whole sonar instance is quite late now (v4.1.1) !
Keep up the good work !

Regards,
Vincent







Reply | Threaded
Open this post in threaded view
|

Re: C# plugin how to import and export fxcop and stylecop rules?

Vincent Labatut
Hi Dinesh,

Thanks for you answer and actions!

Disambibuation: I don't know the "export" feature in SonarQube, but I know the permalinks, I guess we are talking about the permalinks, right?


Export: I share your vision. However you say it is useful "only" when a user needs to run the tool locally, it is obsouvsly to me a MAJOR scenario, we for sure would not want to rely solely on sonar feedback. An issue, when found in Sonar is a bad issue and ideally should not exist, we need to guide the developer at development stage, in his programming IDE (just like a unit test failure). So this is actually *very* important. I'm confident that sooner or later Visual Studio will be able to connect to Sonar's permalinks, resulting in a solid and smooth development experience regarding code quality.

For StyleCop, I have an argument to put some more work on SonarQube's side ;) Since the goal of an export is use the file with StyleCop, I think we should do what's necessary to make the thing work with StyleCop (it's the stylecop plugin, right?). Every version of stylecop come with its own set of default rules. If the Sonar plugin would know about these default rules, it would be able to export the rules so that there is no difference between a server and a local execution.
Example of algorithm: 
 - the rule is actived in SonarQube: export it as activated
 - for every rule that is inactive in Sonar but actived by default: export it as inactive

(this is valid for importing as well, with a similar logic)
This would add a lot of value to SonarQube!
You could say: "sorry, it's not SonarQube's job", I really think it is! unless you give us the possibility to re-import anytime the full config of rules from the files we use locally with the tools? Maybe not the best idea => so exporting for direct use is better, because it fits better SonarQube philosophy.



Import: I share your vision as well. It *should* be a one time job at project initialization. However, support for roundtripping (export, modifiy, then re-import) would be nice. Do not feel offended if some of us prefer editing rules in their favorite tool before reimporting them... Whatever the case, this is non-blocking.
As you stated, I'm coming from 2.1, I can see fewer rules in my migrated test instance but what is configured is configured! (I may ask questions in a separate post)

At the moment, none of theses tasks are "blocking" for me. The export features are important to me because the rules have changed (it seems some have been dropped), and I need to maintain manually our StyleCop and FxCop rules templates that we use on our workstations :( 
That is actually tedious to find which ones, and then update the rules config files manually.

Best regards,
Vincent










On Wed, Dec 3, 2014 at 6:30 PM, Dinesh Bolkensteyn <[hidden email]> wrote:
Hi Vincent,

I agree that the export from SonarQube to FxCop / StyleCop should be much easier to implement as the import.
The export is probably already coded in the plugin (as we need to generate the config files prior to running the tool) - it's only not exposed via the "export" feature within SonarQube.
So I'll split the Jira tickets, to allow at least for independent implementation of the export and the import features:

Export:

Import:

Regarding the import from StyleCop, there were some investigations done recently Arnaud Sylvestre.
It seems that StyleCop will run many rules by default, even if they are not explicitly present in the .StyleCop file.
Hence, it is hard to get the exhaustive list of rules to enable in SonarQube: it would require a tool written in C# itself
Therefore that ticket has been closed as Won't Fix.

Could you clarify why those tickets are blocker for you?

In my mind:

Export: The FxCop / StyleCop tools are executed by SonarQube itself during the analysis. I see the export option useful only in a scenario where you want to allow developers to run those tools locally with the same config as in SonarQube.

Import: It would save the SonarQube administrator the initial effort to configure the quality profile. This should be a one time 1 hour effort. If you are on C# 2.1, and your quality profile is already properly configured, then it will remain so after an upgrade to 3.x, so there is even no effort at all.

Kind regards,



On Wed, Dec 3, 2014 at 4:23 PM, Vincent Labatut <[hidden email]> wrote:
Hi,

I need to import my sonar ruleset (.ruleset files) into my quality profile in SonarQube.

The option to load a ruleset when creating a quality profile has disappeared with C# v3 plugin. After some research I found nothing related to that subject.
Same issue for stylecop (.StyleCop files) rules.

1/ Is there any plan for adding back those options?
2/ Regarding the export, the permalinks for FxCop and Stylecop disappeared as well. Any plans to reimplement them ?


For exporting, at worse, we can still write a small tool in order to transform Sonar rules into proper .StyleCop and .ruleset files.

For importing, it looks important to my eyes that sonar supports such a feature. I'd like Sonar to support round-tripping with fxcop and stylecop rules (just like FindBugs)
Any workaround for importing existing rules with the current version?

Well done with all the work on C# so far, even if I have major regressions in my SonarQube system, I can't upgrade yet to C# 3, our whole sonar instance is quite late now (v4.1.1) !
Keep up the good work !

Regards,
Vincent








Reply | Threaded
Open this post in threaded view
|

Re: C# plugin how to import and export fxcop and stylecop rules?

Camal
This post has NOT been accepted by the mailing list yet.
Hi,
recently we started at my company to use SonarQube. We are now creating a lot of rules using the StyleCop & the Resharper plugins.

We also want to be able to export this rules, so that each member of the team can run analyses on their local machine. We want to have SonarQube as the single source of truth.

So, we are interested in the export feature of both plugins. I am aware of the permanent links tab and the export of the xml, but then we still need a mapping tool to convert these to the real rules datatype the specific tool can process.

How can I upvote this feature for the next releases ? I saw that the last update was a couple of month ago.

https://jira.codehaus.org/browse/SONARRSHPR-9

Chéers,
Camal
Reply | Threaded
Open this post in threaded view
|

Re: C# plugin how to import and export fxcop and stylecop rules?

wrolloff
In reply to this post by Vincent Labatut
Dinesh,

I agree with Vincent that the ability to Export the FxCop/Code Analysis and StyleCop rules are a key feature to ensure that developers can quickly and easily update their local rulesets with the "approved" ruleset maintained in the SonarQube Quality Profile. Are these Export/Permalink updates being added any time soon?
  - FxCop https://jira.codehaus.org/browse/SONARFXCOP-38
  - StyleCop https://jira.codehaus.org/browse/SONARPLUGINS-3835

If not, I am off to manually create one that matches the profile.

Thank you.
Will

Reply | Threaded
Open this post in threaded view
|

Re: C# plugin how to import and export fxcop and stylecop rules?

Dinesh Bolkensteyn-2
Hi Will,

No it is still not planned to work on these 2 tickets in the short term.

Kind regards,


On Tue, May 19, 2015 at 1:50 AM, wrolloff <[hidden email]> wrote:
Dinesh,

I agree with Vincent that the ability to Export the FxCop/Code Analysis and
StyleCop rules are a key feature to ensure that developers can quickly and
easily update their local rulesets with the "approved" ruleset maintained in
the SonarQube Quality Profile. Are these Export/Permalink updates being
added any time soon?
  - FxCop https://jira.codehaus.org/browse/SONARFXCOP-38
  - StyleCop https://jira.codehaus.org/browse/SONARPLUGINS-3835

If not, I am off to manually create one that matches the profile.

Thank you.
Will





--
View this message in context: http://sonarqube.15.x6.nabble.com/C-plugin-how-to-import-and-export-fxcop-and-stylecop-rules-tp5030731p5035481.html
Sent from the SonarQube Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email