Thursday, April 28, 2022

[FIXED] When do I suppress warnings to source vs. Project Suppression File

Issue

I'm working on resolving about 300 warnings and some of the warnings are unnecessary and can be suppressed. However, my question is do I suppress them in the Source - an attribute is added above the method - Or do I suppress them in the GlobalSuppressioins.cs? Is there any guidance for this, if so where?


Solution

The GlobalSuppression.cs file is for SuppressMessage attributes that cannot be placed in the source files. If a suppression can be placed in a source file it should.

Issues that cannot be placed in the source file are things like "namespaces should have at least five classes". You can't place an attribute on a namespace so it goes in the global suppressions file.



Answered By - Philip Smith
Answer Checked By - David Goodson (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.