如何抑制整个空间文件了StyleCop警告 [英] How to suppress a StyleCop warning of entire namespace files

查看:216
本文介绍了如何抑制整个空间文件了StyleCop警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的样式警察版本4.7。全球抑制不选定命名空间的每一个成员的工作。

I'm using Style Cop version 4.7. Global suppression don't work for every member of selected namespace.

我在同一个命名空间(StyleCopSample.Test)两个文件。
当我设置在第一个文件取消的消息,消息只抑制了这个文件,但第二个文件仍然得到一个警告。

I have two files in the same namespace (StyleCopSample.Test). When I set suppress message in the first file, messages are suppressing only for this file, but the second file still gets a warnings.

第一内容文件:

[assembly: SuppressMessage("CSharp.DocumentationRules", "*", Scope = "Namespace", Target = "StyleCopSample.Test")]

namespace StyleCopSample.Test
{
  class TestFirst {}
}

第二个文件内容:

namespace StyleCopSample.Test
{
  class TestSecond {}
}

我不知道要描述的消息打压属性,相同的命名空间的每一个物理文件。任何想法?

I don't want to describe suppress message attribute for every physical file of the same namespace. Any ideas?

感谢您的时间!

推荐答案

SuppressMessage 指令将只处理当前文件(见评论这个问题了StyleCop )。

The SuppressMessage directive will only process the current file (see the comments in this stylecop issue).

您可能可能实现你想要通过的文件列表的,虽然这将工作最好的,如果只有你想将此排除几个文件。如果你想这个应用到所有文件放在一个特定的项目,那么最简单的方式,可能是简单地修改设置通过设置对话框中已经提到。

You could possibly achieve what you want via file lists, although this will work best if there are only a few files you want to apply this exclusion to. If you want this applied to all files in a particular project, then the easiest way may be to simply modify the settings via the settings dialog as already mentioned.

另外,您可以把所有的命名空间相关的文件到一个单独的文件夹中,有一个自定义的设置文件,该文件夹中排除那些特定的文件这些规则。

Alternatively, you could put all the namespace related files into a separate folder, and have a custom settings file in that folder to exclude these rules from those particular files.

这篇关于如何抑制整个空间文件了StyleCop警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆