【问题标题】:How to ignore Stylecop rule SP0100?如何忽略 Stylecop 规则 SP0100?
【发布时间】:2013-01-26 09:50:27
【问题描述】:

如何抑制 Style Cop 规则 SP0100?

枚举项名称 v2007 不符合指定样式:SampleName、Sample_Name。


我尝试关注https://stackoverflow.com/a/3296152/284795

 [SuppressMessage("SP0100")]

但我得到一个错误

'System.Diagnostics.CodeAnalysis.SuppressMessageAttribute' 不包含带 1 个参数的构造函数

【问题讨论】:

    标签: c# .net visual-studio fxcop stylecop


    【解决方案1】:

    你确定你有正确的名字索引吗?

    ElementsMustBeOrderedByAccess seems to be rule SA1202

    编辑

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

    好的,看来您正在使用StyleCop+ 规则 - 这意味着找到合适的抑制数据有点麻烦。

    我在source XML文件中找到了规则的ID信息,如果我理解正确的话,类别应该设置为暴露规则的类的全名,即StyleCopPlus.StyleCopPlusRules .

    这意味着在您的情况下,最小属性声明将是:

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

    【讨论】:

      猜你喜欢
      • 2015-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-03
      • 2013-05-26
      • 2020-10-27
      • 1970-01-01
      • 2023-03-25
      相关资源
      最近更新 更多