Style Content

How to use suppression for custom rules?

+3
source share
2 answers

You can suppress custom rule violations using SuppressMessageAttribute, just as you do for rules that are sent as part of StyleCop. eg:.

[SuppressMessage("Your.Analyzer.Namespace", "AA1000:RuleName")]

(where the namespace, rule identifier, and rule name should be replaced with the actual values ​​for the rule)

+4
source

I use the fact that stylecop ignores areas with "generated code" in the header and does the following:

#region Stylecop will ignore regions with "generated code" in title, like this.

//...code you don't want style cope to test code goes here

#endregion
+2
source

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


All Articles