File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,25 @@ Describe "RuleSuppressionWithoutScope" {
81
81
$suppression = $violationsUsingScriptDefinition | Where-Object {$_.RuleName -eq " PSAvoidDefaultValueForMandatoryParameter" }
82
82
$suppression.Count | Should Be 1
83
83
}
84
+
85
+ It " Suppresses PSAvoidUsingPlainTextForPassword violation for the given ID" {
86
+ $ruleSuppressionIdAvoidPlainTextPassword = @'
87
+ function SuppressPwdParam()
88
+ {
89
+ [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "password1")]
90
+ param(
91
+ [string] $password1,
92
+ [string] $password2
93
+ )
94
+ }
95
+ '@
96
+ Invoke-ScriptAnalyzer `
97
+ - ScriptDefinition $ruleSuppressionIdAvoidPlainTextPassword `
98
+ - IncludeRule " PSAvoidUsingPlainTextForPassword" `
99
+ - OutVariable ruleViolations `
100
+ - SuppressedOnly
101
+ $ruleViolations.Count | Should Be 1
102
+ }
84
103
}
85
104
86
105
if (($PSVersionTable.PSVersion -ge [Version ]' 5.0' ))
You can’t perform that action at this time.
0 commit comments