Code Inspection problem with StyleCop

I'm using Visual Studio 2012 + Resharper 7.1.3 + StyleCop 4.7.
According to this article, we can use GlobalSuppression.cs to get rid of certain warnings.
http://blogs.msdn.com/b/codeanalysis/archive/2006/12/28/faq-what-is-the-globalsuppressions.cs-globalsuppressions.vb-file-and-why-is-it-needed-is-it-possible-to-change-the-name-of-this-file-david-kean.aspx

But in fact, the SuppressMessageAttribute works on the head of class, but *not works* in the GlobalSuppression.cs (the public abstract class Model still underlined).

works:

    [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1630:DocumentationTextMustContainWhitespace", Justification = "Reviewed. Suppression is OK here.")]
    public abstract class Model
    {

    }


not work:

[assembly:
    SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1630:DocumentationTextMustContainWhitespace", 
        Justification = "Reviewed. Suppression is OK here.")]


On the other hand, I see Resharper provides a config dialog in Code Inspection > Inspection Serverity for global/solution personal/solution team-shared/computer:
QQ截图20130510141147.png
So, what's the best practice if I want to suppress some SAxxxx warning in global wide of solution or project.
Is GlobalSuppression.cs still useful or has been ignored?
3 comments
Comment actions Permalink

Hello,

Not sure about StyleCop (since it's a 3rd party plugin for ReSharper), however ReSharper uses its own settings storage for Code Inspections, so the unwanted code inspections should be turned off in ReSharper settings dialog as you've shown it on the 2nd screenshot.

Thanks!

0
Comment actions Permalink

VS 15.8.7 with ReSharper 2018.2.3 - confirmed ReSharper still doesn't look in GlobalSupressions.cs.

It would be great if this could be added, we have common suppressions we need to set at the project level and not all of the team use R# so we want to keep attribute noise to a minimum.

 

Thanks!

1
Comment actions Permalink

VS 15.9.11 with ReSharper 2018.3.4 - Still not working with GlobalSupressions.cs

As the previous comment, my team in Mexico works with R#, but the team in India don't have it. Please add this functionallity as we want to keep the ReSharper configuration separated from code as other teams could delete them by error or QA.

0

Please sign in to leave a comment.