Skip to content

Commit da45614

Browse files
author
Quoc Truong
committed
Fix test failures
1 parent ef6d8a6 commit da45614

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

Tests/Engine/RuleSuppression.ps1

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,17 @@ Param(
66
function 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

1726
function 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
}

Tests/Engine/RuleSuppression.tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)