0

There seem to various questions asking specifically how to suppress particular stylecop warnings, for example:

[SuppressMessage("Microsoft.StyleCop.CSharp.OrderingRules", "SA1202:ElementsMustBeOrderedByAccess"]

But where can I authoratively look to get the short name of the rule and (particularly) the namespace containing it. I have downloaded the stylecop project and looked at the project ruleset without finding anything useful. There seem to be some global rules prefixed SA, and I can't find a good reference on them.

This talks about suppressing rules, but doesn't lead to namespace information on SA rules https://blogs.msdn.com/b/sourceanalysis/archive/2009/08/10/rule-suppressions.aspx?Redirected=true.

Documentation such as http://stylecop.soyuz5.com/SA1202.html is deeply unhelpful in providing the rule category name, but not the actual namespace.

Silas Davis
  • 712
  • 1
  • 9
  • 15

1 Answers1

0

I don't know about any published documentation containing that namespaces, but you can certainly look it up in the source code.

https://github.com/StyleCop/StyleCop/blob/007dc67059b53cc5a94be676f17ad3ea8881d4ad/Project/Src/StyleCop.CSharp.Rules/OrderingRules.cs

From the file above you can see that fully qualified name for ordering rules would be StyleCop.CSharp.OrderingRules.

https://github.com/StyleCop/StyleCop/blob/007dc67059b53cc5a94be676f17ad3ea8881d4ad/Project/Src/StyleCop.CSharp.Rules/OrderingRules.xml

From this file you can get shortname:longname values. For ordering rules we can see that it would be SA1202:ElementsMustBeOrderedByAccess.

Grault
  • 974
  • 12
  • 31
Oleg Shuruev
  • 1,339
  • 8
  • 10