Is it possible to limit FxCop / StyleCop only to the analysis of the selected methods using Visual Studio?

I take a maintenance team and would like to introduce tools like FxCop and StyleCop to help improve the code and introduce developers to the best programming methods and standards. Since we maintain the code and do not make significant improvements, we are likely to deal with only a few methods / routines at the same time as making changes.

Is it possible to configure FxCop / StyleCop for certain areas of code in Visual Studio to avoid overflowing all the problems that would arise when analyzing an entire class or project? If possible, how do you do it?

Thanks Matt

+4
source share
5 answers

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

/types:<type list> [Short form: /t:<type list>] Analyze only these types and members. 
+3
source

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

However, for both of them, you can target specific rules rather than types that may work better to reduce the amount of β€œnoise” to more manageable blocks.

+1
source

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 beady eye by adding properties to include or exclude each file in .csproj

+1
source

I would suggest that it cannot (seems too specific).

-1
source

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

-1
source

Source: https://habr.com/ru/post/1276942/


All Articles