Otterprinz
Otterprinz

Reputation: 469

Stylecop SuppressMessage on specific namespace

i got my enums collected in a namespace. Because of that, i have a *.cs file, that contains enums, no classes. Stylecop complains, and i want to supress it, but just for this file/namespace. Not globally, so i dont want to turn off the rule.

   [module:  System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:FileHeaderFileNameDocumentationMustMatchTypeName", Scope = "namespace", Target = "SoftwareProject.Enums", Justification = "Reviewed.")]
   namespace SoftwareProject.Enums
   {
     // Enums here
   }

I can not get this SuppressMessage to work on just this namespace. Its works on the module, just like it does if i just delete the Scope and Target settings.

What am i missing?

Upvotes: 2

Views: 786

Answers (1)

Otterprinz
Otterprinz

Reputation: 469

I found my answer:

The SuppressMessage attribute also takes the following optional parameters. These parameters are completely ignored by StyleCop and do not need to be filled in for StyleCop suppressions.

Message Id

Scope

Target

Source: StyleCop Help File. Found by right clicking on the warning -> Show Help.

Upvotes: 2

Related Questions