File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,15 @@ Function do-something
21
21
}
22
22
'@
23
23
24
+ $ruleSuppressionInConfiguration = @'
25
+ Configuration xFileUpload
26
+ {
27
+ [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")]
28
+ param ([string] $decryptedPassword)
29
+ $securePassword = ConvertTo-SecureString $decryptedPassword -AsPlainText -Force
30
+ }
31
+ '@
32
+
24
33
Describe " RuleSuppressionWithoutScope" {
25
34
Context " Function" {
26
35
It " Does not raise violations" {
@@ -49,6 +58,13 @@ Describe "RuleSuppressionWithoutScope" {
49
58
}
50
59
}
51
60
61
+ Context " Rule suppression within DSC Configuration definition" {
62
+ It " Suppresses rule" {
63
+ $suppressedRule = Invoke-ScriptAnalyzer - ScriptDefinition $ruleSuppressionInConfiguration - SuppressedOnly
64
+ $suppressedRule.Count | Should Be 1
65
+ }
66
+ }
67
+
52
68
if (! $testingLibraryUsage )
53
69
{
54
70
Context " Bad Rule Suppression" {
You can’t perform that action at this time.
0 commit comments