Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resharper to load StyleCop settings

I'm using Resharper 7.1 and StyleCop 4.7 (with Visual Studio 2012). By default Resharper loads all the StyleCop rules for inspection and for all off them the action to be taken is "Warning", even though in the Settings.StyleCop file some of the rules are disabled.

If a certain StyleCop rule is disabled I would like Resharper to "Do not show" anything (because of course, not all the default rules make sense all the time).

I know this can be done manually in the Resharper - Options - Inspection Severity, by choosing yourself what action to take for each rule. But is there a way to do this automatically? That is, make resharper not warn you about a rule being broken if it's disabled in Stylecop.Settings?

It makes sense to do this automatically, because I want to define a set of mandatory rules for all team to apply, and it would be redundant to have each engineer manually fix the action taken for each existing rule (since they are a lot).

Thanks in advance, Mihai

like image 365
Mihai Veres Avatar asked Mar 01 '13 16:03

Mihai Veres


People also ask

How do I open StyleCop settings editor?

If you are on Windows, the Settings. StyleCop file can be opened from the Explorer and edited through a GUI. If that doesn't work, try dragging the Settings file onto an application called StyleCopSettingsEditor.exe which is installed in your StyleCop Program Files folder.

How do I enable StyleCop in VS 2022?

The stylecop feature doesn't work with Visual Studio 2022 . The Compatible versions are Visual Studio 2012, 2013, 2015, 2017, 2019 . Please try to always add a source to statements like this (even if it is obviously correct in this case 😉).

How do I add StyleCop to Visual Studio?

Open a project in your Visual Studio. Right-click on the project file in the explorer solution panel, and then click on StyleCop Settings... to open the configuration window as shown in the following screenshot: Once you have finished selecting the rules you need, you can launch your first analysis of code.


1 Answers

It seems there is no way to do this, although, it is possible to configure the rules manually in Resharper options and then export your options (via Manage -> Export to File) and they can be imported on other machines.

like image 51
Mihai Veres Avatar answered Sep 20 '22 06:09

Mihai Veres