0

I tried using the following directive to tell StyleCop to avoid an entire namespace:

[module: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "*", Justification = "Reviewed. Suppression is OK here.")]

However, this does not appear to work. I have a third party plugin that generates Help documentation, and I don't care to run StyleCop on their code.

Is it even possible to suppress on a namespace level?

Scott Wylie
  • 4,725
  • 2
  • 36
  • 48
appsecguy
  • 1,019
  • 3
  • 19
  • 36

1 Answers1

0

According to http://blogs.msdn.com/b/sourceanalysis/archive/2009/08/10/rule-suppressions.aspx you cannot use global suppressions. You have to attach each suppression to a code element.

StyleCop only checks source code not IL code. If StyleCop checks the code of the third party plugin, then maybe you have attached the project of the third party plugin to your solution rather than a reference to its compiled assembly.

You have three options:

  • Add a reference to the compiled assembly of the third party library in your project. This way the StyleCop rules won't be checked against the third party library.
  • Suppress the rules at each code element if the third party plugin is added as a project to your solution. That means you will change the source code of the third party library.
  • Disable all StyleCop rules for the third party plugin if it is added as a project to your solution. Right click on the project node and select StyleCop Settings.
Yavuz
  • 630
  • 6
  • 20