views:

526

answers:

5

I am taking on a maintenance team and would like to introduce tools like FxCop and StyleCop to help improve the code and introduce the developers to better programming techniques and standards. Since we are maintaining code and not making significant enhancements, we will probably only deal with a couple of methods/routines at a time when making changes.

Is it possible to target FxCop/StyleCop to specific areas of code within Visual Studio to avoid getting overwhelmed with all of the issues that would get raised when analyzing a whole class or project? If it is possible, how do you go about it?

Thanks, Matt

A: 

I would guess that it can't (seems a too-specific need).

ripper234
+3  A: 

I am using FxCopCmd.exe (FxCop 1.36) as an external tool with various command line parameters, including this one:

/types:<type list>  [Short form: /t:<type list>]
Analyze only these types and members.
alexandrul
+1  A: 

FxCop can target specific types using either the command line or the GUI. StyleCop does not provide such a mechanism.

However, for both of them you can target specific rules instead types which may work better to reduce the amount of "noise" to more manageable chunks.

Scott Dorman
A: 

Creating new rules for FXCop is possible, but "advanced". Configuring FXCop to only use certain rules from those available is trivial.

Dominic Cronin
+1  A: 

Try the approach in this article

http://blogs.msdn.com/sourceanalysis/archive/2008/11/11/introducing-stylecop-on-legacy-projects.aspx

You can remove individual files from StyleCop's beady eye by adding properties to include or exclude each file in the .csproj

Col