取消针对特定退货类型的StyleCop文档规则SA1615

时间:2019-02-06 01:54:10

标签: c# suppress-warnings stylecop

我正在为我的MVC项目使用StyleCop分析器,它添加的规则之一是SA1615: "Element return value must be documented"。很好,但是在某些返回类型中,我不想为每个方法编写冗余消息,例如返回ActionResultPartialViewResult的控制器操作。

我有一个GlobalSuppressions.cs文件,在其中尝试了以下suppression annotations

// Works, but suppresses ALL SA1615 occurrences
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1615", Justification = "Unnecessary.")]

// Doesn't work, presumably because the violations occur in my controller class, not System.Web.Mvc.ActionResult
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1615", Scope = "type", Target = "System.Web.Mvc.ActionResult", Justification = "Unnecessary.")]

对于所有具有这些返回类型的方法,我如何选择性地禁止显示此警告?

0 个答案:

没有答案