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 6
6
function SuppressMe ()
7
7
{
8
8
[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
+ )
11
20
{
12
21
Write-Host " I do nothing"
13
22
}
@@ -16,9 +25,18 @@ function SuppressMe ()
16
25
17
26
function SuppressTwoVariables ()
18
27
{
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
+ )
22
40
{
23
41
}
24
42
}
Original file line number Diff line number Diff line change @@ -49,9 +49,9 @@ Describe "RuleSuppressionWithoutScope" {
49
49
50
50
Context " RuleSuppressionID" {
51
51
It " Only suppress violations for that ID" {
52
- $suppression = $violations | Where-Object {$_.RuleName -eq " PSProvideDefaultParameterValue " }
52
+ $suppression = $violations | Where-Object {$_.RuleName -eq " PSAvoidDefaultValueForMandatoryParameter " }
53
53
$suppression.Count | Should Be 1
54
- $suppression = $violationsUsingScriptDefinition | Where-Object {$_.RuleName -eq " PSProvideDefaultParameterValue " }
54
+ $suppression = $violationsUsingScriptDefinition | Where-Object {$_.RuleName -eq " PSAvoidDefaultValueForMandatoryParameter " }
55
55
$suppression.Count | Should Be 1
56
56
}
57
57
}
You can’t perform that action at this time.
0 commit comments