I saw similar questions but was unable to find the answer, even though some of them were marked as answered. I'm using ReSharper 6.1.1 and StyleCop 4.7.11.0. I put Settings.StyleCop file in the my solution's root folder. I unchecked documentation rules, so StyleCop settings look like this:
I even set "Do not merge with other settings files" option.
Then I open my solution, go to ReSharper -> Cleanup and delete current StyleCop preset.
Then I save and reopen ReSharper settings and go to Tools -> StyleCop and click "Reset C# code style options" button.
Then I save and reopen ReSharper settings again. I can see new CodeCleanup preset "StyleCop" and I suppose that this preset MUST be in sync with my Settings.StyleCop file. But it's not, Documentation section is still checked:
So, what am I doing wrong? PS: sorry for a lot of pictures, but I do believe that they clarify my question.
You can look it up on the Code Editing | [Language] | Formatting Style page of ReSharper options ( Alt+R, O ) or alternatively, you can select a code block where the desired rule applies, press Alt+Enter , and choose Format selection | Configure.
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.
Right-click on the project or solution name in Solution Explorer, select Analyze and Code Cleanup, and then select Run Code Cleanup.
You can see this in the warnings section when you run stylecop in your project. Find with key word SA1005 and you should see that in result section. Just uncheck.
That is correct functionality. The ReSharper code cleanup styles are saved in the ReSharper settings file, and the StyleCop rules in the StyleCop settings file. They provide slightly different functionality in that the ReSharper plugin cleans up your code, while StyleCop simply checks your code. You have a point in that they perhaps should reference the same settings, but that isn't how it currently works.
I'm sure there is an explanation why (ie, they may have designed it to allow you to clean up the code but not enforce the rules), but that's probably best asked on the StyleCop website.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With