如何燮preSS一个了StyleCop警告?preSS、StyleCop

2023-09-02 10:30:55 作者:再不努力我们就老了

我使用了StyleCop,并希望晚饭preSS一些警告这不适合我的风格。我preFER有解决方案:1)在线code燮pressing和2)全局设置SUP pressing。我在网上搜索,但still不知道怎么做的SUP pressing。对于方法1),他们说,添加行

I'm using StyleCop and want to suppress some warning which does not suit my style. I prefer to have solution for 1) in-line code suppressing and 2) global setting suppressing . I've searched the internet but still not sure how to do the suppressing. For method 1), They said to add the lines

[assembly: SuppressMessage("Microsoft.Design", 
"SA1202:All private methods must be placed after all public methods", 
 Scope = "namespace", Target = "Consus.Client.ClientVaultModule.Services.OnlineDetection")]

但他们不说在哪里,并使用该命名空间。对于方法2),他们说要用GlobalSup preSS文件,但它似乎是不容易的搜索如何对目前做到这一点。

But they do not say where and which namespace to be used. For method 2), they said to use GlobalSuppress file but it seems not easy to search for a how-to do it at the moment.

请帮忙。

就我而言,我对 SA1202警告:所有的私有方法必须放在所有公共方法这是因为我组我的相关codeS打扰到区域之后。我想晚饭preSS这些警告的只是一些特定的方法。

In my case, I have the warning about SA1202: All private methods must be placed after all public methods which is bothering since I group my related codes into regions. I want to suppress those warning for just some certain methods.

推荐答案

下面是你需要的:

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