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
Copy file name to clipboardExpand all lines: README.md
+80Lines changed: 80 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,86 @@ If you have previous version of PSScriptAnalyzer installed on your machine, you
39
39
40
40
To confirm installation: run ```Get-ScriptAnalyzerRule``` in the PowerShell console to obtain the built-in rules
41
41
42
+
Suppressing Rules
43
+
=================
44
+
45
+
You can suppress a rule by decorating a script/function or script/function parameter with .NET's [SuppressMessageAttribute](https://msdn.microsoft.com/en-us/library/system.diagnostics.codeanalysis.suppressmessageattribute.aspx). `SuppressMessageAttribute`'s constructor takes two parameters: a category and a check ID. Set the `categoryID` parameter to the name of the rule you want to suppress (you may omit the `checkID` parameter):
To suppress a rule for an entire function/script, decorate the `param` block of the script/function and set the `SuppressMessageAttribute's``Scope` property to `Function`:
Finally, you can restrict suppression inside a scope by setting the `SuppressMessageAttribute's``Target` property to a regular expression that causes the script analyzer to skip functions/variables/parameters/objects whose names match the regular expression.
0 commit comments