Colonel Panic
Colonel Panic

Reputation: 137544

How to ignore Stylecop rule SP0100?

How to suppress Style Cop rule SP0100?

Enumeration item name v2007 doesn't conform the specified style: SampleName, Sample_Name.


I tried following https://stackoverflow.com/a/3296152/284795

 [SuppressMessage("SP0100")]

But I get an error

'System.Diagnostics.CodeAnalysis.SuppressMessageAttribute' does not contain a constructor that takes 1 arguments

Upvotes: 2

Views: 2069

Answers (1)

Jean Hominal
Jean Hominal

Reputation: 16796

Are you sure that you have the index of the name right?

ElementsMustBeOrderedByAccess seems to be rule SA1202

EDIT:

You should check the Microsoft documentation for rule suppressions, which explains the constructor syntax.

OK, so it seems you are using a StyleCop+ rule - meaning that it is a bit of a pain to find the appropriate suppression data.

I have found the information for the ID in the source XML file for the rules, and, if I understand correctly, the category should be set to the full name of the class that exposes the rule, which is StyleCopPlus.StyleCopPlusRules.

Meaning that the minimal attribute declaration, in your case, would be:

[SuppressMessage("StyleCopPlus.StyleCopPlusRules","SP0100:AdvancedNamingRules")]

Upvotes: 8

Related Questions