File tree Expand file tree Collapse file tree 2 files changed +25
-7
lines changed
Expand file tree Collapse file tree 2 files changed +25
-7
lines changed Original file line number Diff line number Diff line change 66function SuppressMe ()
77{
88 [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute (" PSProvideCommentHelp" )]
9- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute (" PSProvideDefaultParameterValue" , " unused1" )]
10- Param ([string ]$unUsed1 , [int ] $unUsed2 )
9+ [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute (" PSAvoidDefaultValueForMandatoryParameter" , " unused1" )]
10+ [CmdletBinding ()]
11+ Param (
12+ [Parameter (Mandatory = $true )]
13+ [string ]
14+ $unUsed1 = " unused" ,
15+
16+ [Parameter (Mandatory = $true )]
17+ [int ]
18+ $unUsed2 = 3
19+ )
1120 {
1221 Write-Host " I do nothing"
1322 }
@@ -16,9 +25,18 @@ function SuppressMe ()
1625
1726function SuppressTwoVariables ()
1827{
19- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute (" PSProvideDefaultParameterValue" , " b" )]
20- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute (" PSProvideDefaultParameterValue" , " a" )]
21- Param ([string ]$a , [int ]$b )
28+ [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute (" PSAvoidDefaultValueForMandatoryParameter" , " b" )]
29+ [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute (" PSAvoidDefaultValueForMandatoryParameter" , " a" )]
30+ [CmdletBinding ()]
31+ Param (
32+ [Parameter (Mandatory = $true )]
33+ [string ]
34+ $a = " unused" ,
35+
36+ [Parameter (Mandatory = $true )]
37+ [int ]
38+ $b = 3
39+ )
2240 {
2341 }
2442}
Original file line number Diff line number Diff line change @@ -49,9 +49,9 @@ Describe "RuleSuppressionWithoutScope" {
4949
5050 Context " RuleSuppressionID" {
5151 It " Only suppress violations for that ID" {
52- $suppression = $violations | Where-Object {$_.RuleName -eq " PSProvideDefaultParameterValue " }
52+ $suppression = $violations | Where-Object {$_.RuleName -eq " PSAvoidDefaultValueForMandatoryParameter " }
5353 $suppression.Count | Should Be 1
54- $suppression = $violationsUsingScriptDefinition | Where-Object {$_.RuleName -eq " PSProvideDefaultParameterValue " }
54+ $suppression = $violationsUsingScriptDefinition | Where-Object {$_.RuleName -eq " PSAvoidDefaultValueForMandatoryParameter " }
5555 $suppression.Count | Should Be 1
5656 }
5757 }
You can’t perform that action at this time.
0 commit comments