ReSharper is a great tool for identifying problems with your code. Simply right-click on any project in the Solution Explorer and select Find Code Issues. After ReSharper analyzes all the files, you’ll see a window with several categories of issues including “Common Practices and Code Improvements”, “Constraint Violations”, and “Potential Code Quality Issues”.
Unfortunately, when you create a new ASP.NET MVC 3 application in Visual Studio 2010, Resharper will find thousands of code issues before you even start coding.
Most of these “issues” are in jQuery and Microsoft’s AJAX libraries, and your average developer is not going to go around adding semicolons all day when they have real work to do. So we need to tell ReSharper to ignore these known issues somehow.
It would be nice if ReSharper allowed you to ignore files using file masks, but it doesn’t. You must specify each file or folder individually. Go to ReSharper->Options…->Code Inspection->Settings. Click Edit Items to Skip.
My first instinct was to lasso or shift-click to select all the jQuery scripts, but this is not allowed! I certainly wasn’t going to bounce back and forth between dialog windows a dozen times just to add each file.
Luckily this is ReSharper, and we can move all the script files into another directory and update references automatically. Select all the jQuery scripts in the Scripts folder simultaneously, right-click, and go to Refactor->Move. Create a new jquery folder under Scripts and click Next.
Now you can go back into the ReSharper options and add this folder to the list of items to skip.
Move Microsoft’s script files into their own folder, and tell ReSharper to ignore these as well. I’m also using modernizr so I exluded the two modernizr scripts individually.
Find Code Issues again and things should look much better. I’ve only got 25 issues now.
With the help of ReSharper’s refactoring capabilities I was able to get this down to one issue in just a few minutes. Now you can get on with your project without having to mentally filter out a bunch of noise in the Inspection Results window.