You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
^ These links either isn't relevant anymore (first one, it's moved to Discord, right?), or does not work (the two others)
Say I have a script I'm just using for inspiration, I have no plans of iterating and improving it.
We can use [Diagnostics.CodeAnalysis.SuppressMessageAttribute()] to supress one rule. We can not use wildcard ( [Diagnostics.CodeAnalysis.SuppressMessageAttribute('*','')] ) to suppress all rules, I've tried.
Is it possible to disable PSSA or suppress all rules for one script/file, from inside that file? I don't want to hardcode paths in global PSSA settings.
To get PSSA and VSCode "Problems" tab to stay quiet I now have all these in top of the script:
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText','')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingInvokeExpression','')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost','', Justification ='Used to output text with color')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter','')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseApprovedVerbs','')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseLiteralInitializerForHashtable','')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions','')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns','')]
This is with the following Microsoft maintained script btw.:
The text was updated successfully, but these errors were encountered:
o-l-a-v
changed the title
Disable PSSA or supress all rules for **one** file
Disable PSSA or supress all rules for **one** file without excluding path in settings.psd1?
Feb 28, 2025
RoleDocumentation
folder for more information on each rule:https://github.com/PowerShell/PSScriptAnalyzer/tree/development/RuleDocumentation
^ These links either isn't relevant anymore (first one, it's moved to Discord, right?), or does not work (the two others)
Say I have a script I'm just using for inspiration, I have no plans of iterating and improving it.
We can use
[Diagnostics.CodeAnalysis.SuppressMessageAttribute()]
to supress one rule. We can not use wildcard ([Diagnostics.CodeAnalysis.SuppressMessageAttribute('*','')]
) to suppress all rules, I've tried.Is it possible to disable PSSA or suppress all rules for one script/file, from inside that file? I don't want to hardcode paths in global PSSA settings.
To get PSSA and VSCode "Problems" tab to stay quiet I now have all these in top of the script:
This is with the following Microsoft maintained script btw.:
The text was updated successfully, but these errors were encountered: