File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,15 @@ Function do-something
2121}
2222'@
2323
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+
2433Describe " RuleSuppressionWithoutScope" {
2534 Context " Function" {
2635 It " Does not raise violations" {
@@ -49,6 +58,13 @@ Describe "RuleSuppressionWithoutScope" {
4958 }
5059 }
5160
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+
5268 if (! $testingLibraryUsage )
5369 {
5470 Context " Bad Rule Suppression" {
You can’t perform that action at this time.
0 commit comments