Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you force StyleCop for ReSharper to ignore files?

We’ve just been working on introducing StyleCop to our team and are using the StyleCop ReSharper plugin from Code Plex. Problem is, every single file in the project appears to be getting analysed and we can’t find a way to exclude particular files. This includes files such as the designer.cs file from the DBML or third party components included in the project. What this means is your site wide code analysis in ReSharper always shows up errors and you can never get it to go “green”.

There’s always the ExcludeFromStyleCop tag which you can put in the .csproj but this is only used by MSBuild. Right clicking the file in the ReSharper error window and telling it to “Ignore Errors” also doesn’t seem to work; the window just reloads and the same file gets analysed again.

Anyone got any ideas on this?

like image 285
Troy Hunt Avatar asked Mar 04 '09 21:03

Troy Hunt


3 Answers

This was what I was looking for, except in Resharper 6 the correct keystroke to disable inspection in a specific file is: Ctrl + Shift + Alt + 8

like image 183
Chris Wegener Avatar answered Oct 23 '22 10:10

Chris Wegener


"Are you sure you have have unchecked the StyleCop settings option that specifies stylecop should check designer files? (StyleCop Options > Rules > Detailed Settings > Analyze Designer Files)?"

http://stylecopforresharper.codeplex.com/Thread/View.aspx?ThreadId=47346

like image 27
stuartd Avatar answered Oct 23 '22 10:10

stuartd


You can completely disable ReSharper for a particular file by pressing CTRL + 8. You'll see the little 'eye' in the top right of the code window (at the top of the gutter) go grey, indicating it's disabled.

Press the keystroke again to re-enable it.

like image 31
Drew Noakes Avatar answered Oct 23 '22 12:10

Drew Noakes