Skip to content

Commit b478613

Browse files
committed
Remove extraneous import-module commands
The expectation is that these tests are run as part of the test harness, the re-importing of the module is unneeded
1 parent 1a8d285 commit b478613

File tree

65 files changed

+73
-184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+73
-184
lines changed

Tests/Engine/CorrectionExtent.tests.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
Import-Module PSScriptAnalyzer
2-
31
Describe "Correction Extent" {
42
$type = [Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.CorrectionExtent]
53

Tests/Engine/CustomizedRule.tests.ps1

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
2-
# Check if PSScriptAnalyzer is already loaded so we don't
3-
# overwrite a test version of Invoke-ScriptAnalyzer by
4-
# accident
5-
if (!(Get-Module PSScriptAnalyzer) -and !$testingLibraryUsage)
6-
{
7-
Import-Module PSScriptAnalyzer
8-
}
9-
10-
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
1+
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
112
$testRootDirectory = Split-Path -Parent $directory
123
Import-Module (Join-Path $testRootDirectory 'PSScriptAnalyzerTestHelper.psm1')
134

Tests/Engine/EditableText.tests.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
22
$testRootDirectory = Split-Path -Parent $directory
33

4-
Import-Module PSScriptAnalyzer
54
Import-Module (Join-Path $testRootDirectory "PSScriptAnalyzerTestHelper.psm1")
65

76
$editableTextType = "Microsoft.Windows.PowerShell.ScriptAnalyzer.EditableText"

Tests/Engine/Extensions.tests.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
22
$testRootDirectory = Split-Path -Parent $directory
3-
4-
Import-Module PSScriptAnalyzer
53
Import-Module (Join-Path $testRootDirectory "PSScriptAnalyzerTestHelper.psm1")
64

75
function Get-Extent {

Tests/Engine/GetScriptAnalyzerRule.tests.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
21
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
3-
Import-Module -Verbose PSScriptAnalyzer
42
$testRootDirectory = Split-Path -Parent $directory
53
Import-Module (Join-Path $testRootDirectory 'PSScriptAnalyzerTestHelper.psm1')
64
$sa = Get-Command Get-ScriptAnalyzerRule
@@ -175,7 +173,7 @@ Describe "TestWildCard" {
175173
}
176174

177175
It "filters rules based on wild card input and severity"{
178-
$rules = Get-ScriptAnalyzerRule -Name PSDSC* -Severity Information
176+
$rules = Get-ScriptAnalyzerRule -Name PSDSC* -Severity Information
179177
$rules.Count | Should -Be 4
180178
}
181179
}

Tests/Engine/Helper.tests.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
Import-Module PSScriptAnalyzer
2-
31
Describe "Test Directed Graph" {
42
Context "When a graph is created" {
53
$digraph = New-Object -TypeName 'Microsoft.Windows.PowerShell.ScriptAnalyzer.DiGraph[string]'
@@ -28,4 +26,4 @@ Describe "Test Directed Graph" {
2826
$digraph.IsConnected('v1', 'v4') | Should -BeTrue
2927
}
3028
}
31-
}
29+
}

Tests/Engine/InvokeFormatter.tests.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
22
$testRootDirectory = Split-Path -Parent $directory
3-
4-
Import-Module PSScriptAnalyzer
53
Import-Module (Join-Path $testRootDirectory "PSScriptAnalyzerTestHelper.psm1")
64

75
Describe "Invoke-Formatter Cmdlet" {

Tests/Engine/InvokeScriptAnalyzer.tests.ps1

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
# Check if PSScriptAnalyzer is already loaded so we don't
2-
# overwrite a test version of Invoke-ScriptAnalyzer by
3-
# accident
4-
if (!(Get-Module PSScriptAnalyzer) -and !$testingLibraryUsage)
5-
{
6-
Import-Module PSScriptAnalyzer
7-
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
8-
$testRootDirectory = Split-Path -Parent $directory
9-
Import-Module (Join-Path $testRootDirectory 'PSScriptAnalyzerTestHelper.psm1')
10-
}
11-
12-
$sa = Get-Command Invoke-ScriptAnalyzer
1+
$sa = Get-Command Invoke-ScriptAnalyzer
132
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
143
$singularNouns = "PSUseSingularNouns"
154
$approvedVerb = "PSUseApprovedVerbs"

Tests/Engine/LibraryUsage.tests.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
22
$testRootDirectory = Split-Path -Parent $directory
33
Import-Module (Join-Path $testRootDirectory 'PSScriptAnalyzerTestHelper.psm1')
4-
Import-Module PSScriptAnalyzer
54

6-
# test is meant to verify functionality if chsarp apis are used. Hence not if psedition is CoreCLR
5+
# test is meant to verify functionality if csharp apis are used. Hence not if psedition is CoreCLR
76
if ((Test-PSEditionCoreCLR))
87
{
98
return

Tests/Engine/RuleSuppression.tests.ps1

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
# Check if PSScriptAnalyzer is already loaded so we don't
2-
# overwrite a test version of Invoke-ScriptAnalyzer by
3-
# accident
4-
if (!(Get-Module PSScriptAnalyzer) -and !$testingLibraryUsage)
5-
{
6-
Import-Module -Verbose PSScriptAnalyzer
7-
}
8-
9-
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
1+
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
102
$testRootDirectory = Split-Path -Parent $directory
113
Import-Module (Join-Path $testRootDirectory 'PSScriptAnalyzerTestHelper.psm1')
124

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
if ($PSVersionTable.PSVersion -ge [Version]'5.0.0') {
2-
3-
# Check if PSScriptAnalyzer is already loaded so we don't
4-
# overwrite a test version of Invoke-ScriptAnalyzer by
5-
# accident
6-
if (!(Get-Module PSScriptAnalyzer) -and !$testingLibraryUsage)
7-
{
8-
Import-Module -Verbose PSScriptAnalyzer
1+
$script:skipForV3V4 = $true
2+
if ($PSVersionTable.PSVersion -ge [Version]'5.0.0') {
3+
$script:skipForV3V4 = $false
94
}
105

116
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
@@ -15,7 +10,7 @@ $violations = Invoke-ScriptAnalyzer "$directory\RuleSuppression.ps1"
1510
Describe "RuleSuppressionWithoutScope" {
1611

1712
Context "Class" {
18-
It "Does not raise violations" {
13+
It "Does not raise violations" -skip:$script:skipForV3V4 {
1914
$suppression = $violations | Where-Object {$_.RuleName -eq "PSAvoidUsingInvokeExpression" }
2015
$suppression.Count | Should -Be 0
2116
$suppression = $violationsUsingScriptDefinition | Where-Object {$_.RuleName -eq "PSAvoidUsingInvokeExpression" }
@@ -24,7 +19,7 @@ Describe "RuleSuppressionWithoutScope" {
2419
}
2520

2621
Context "FunctionInClass" {
27-
It "Does not raise violations" {
22+
It "Does not raise violations" -skip:$script:skipForV3V4 {
2823
$suppression = $violations | Where-Object {$_.RuleName -eq "PSAvoidUsingCmdletAliases" }
2924
$suppression.Count | Should -Be 0
3025
$suppression = $violationsUsingScriptDefinition | Where-Object {$_.RuleName -eq "PSAvoidUsingCmdletAliases" }
@@ -33,7 +28,7 @@ Describe "RuleSuppressionWithoutScope" {
3328
}
3429

3530
Context "Script" {
36-
It "Does not raise violations" {
31+
It "Does not raise violations" -skip:$script:skipForV3V4 {
3732
$suppression = $violations | Where-Object {$_.RuleName -eq "PSProvideCommentHelp" }
3833
$suppression.Count | Should -Be 0
3934
$suppression = $violationsUsingScriptDefinition | Where-Object {$_.RuleName -eq "PSProvideCommentHelp" }
@@ -42,7 +37,7 @@ Describe "RuleSuppressionWithoutScope" {
4237
}
4338

4439
Context "RuleSuppressionID" {
45-
It "Only suppress violations for that ID" {
40+
It "Only suppress violations for that ID" -skip:$script:skipForV3V4 {
4641
$suppression = $violations | Where-Object {$_.RuleName -eq "PSAvoidDefaultValueForMandatoryParameter" }
4742
$suppression.Count | Should -Be 1
4843
$suppression = $violationsUsingScriptDefinition | Where-Object {$_.RuleName -eq "PSAvoidDefaultValueForMandatoryParameter" }
@@ -53,7 +48,7 @@ Describe "RuleSuppressionWithoutScope" {
5348

5449
Describe "RuleSuppressionWithScope" {
5550
Context "FunctionScope" {
56-
It "Does not raise violations" {
51+
It "Does not raise violations" -skip:$script:skipForV3V4 {
5752
$suppression = $violations | Where-Object {$_.RuleName -eq "PSAvoidUsingPositionalParameters" }
5853
$suppression.Count | Should -Be 0
5954
$suppression = $violationsUsingScriptDefinition | Where-Object {$_.RuleName -eq "PSAvoidUsingPositionalParameters" }
@@ -62,12 +57,11 @@ Describe "RuleSuppressionWithScope" {
6257
}
6358

6459
Context "ClassScope" {
65-
It "Does not raise violations" {
60+
It "Does not raise violations" -skip:$script:skipForV3V4 {
6661
$suppression = $violations | Where-Object {$_.RuleName -eq "PSAvoidUsingConvertToSecureStringWithPlainText" }
6762
$suppression.Count | Should -Be 0
6863
$suppression = $violationsUsingScriptDefinition | Where-Object {$_.RuleName -eq "PSAvoidUsingConvertToSecureStringWithPlainText" }
6964
$suppression.Count | Should -Be 0
7065
}
7166
}
72-
}
73-
}
67+
}

Tests/Engine/Settings.tests.ps1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
if (!(Get-Module PSScriptAnalyzer)) {
2-
Import-Module PSScriptAnalyzer
3-
}
4-
51
$directory = Split-Path $MyInvocation.MyCommand.Path
62
$settingsTestDirectory = [System.IO.Path]::Combine($directory, "SettingsTest")
73
$project1Root = [System.IO.Path]::Combine($settingsTestDirectory, "Project1")

Tests/Engine/TextEdit.tests.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
Import-Module PSScriptAnalyzer
2-
31
Describe "TextEdit Class" {
42
$type = [Microsoft.Windows.PowerShell.ScriptAnalyzer.TextEdit]
53

Tests/Rules/AlignAssignmentStatement.tests.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
22
$testRootDirectory = Split-Path -Parent $directory
33

4-
Import-Module PSScriptAnalyzer
54
Import-Module (Join-Path $testRootDirectory "PSScriptAnalyzerTestHelper.psm1")
65

76
$ruleConfiguration = @{

Tests/Rules/AvoidAssignmentToAutomaticVariable.tests.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Import-Module PSScriptAnalyzer
2-
$ruleName = "PSAvoidAssignmentToAutomaticVariable"
1+
$ruleName = "PSAvoidAssignmentToAutomaticVariable"
32

43
Describe "AvoidAssignmentToAutomaticVariables" {
54
Context "ReadOnly Variables" {
@@ -71,4 +70,4 @@ Describe "AvoidAssignmentToAutomaticVariables" {
7170
}
7271

7372
}
74-
}
73+
}

Tests/Rules/AvoidConvertToSecureStringWithPlainText.tests.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Import-Module PSScriptAnalyzer
2-
Set-Alias ctss ConvertTo-SecureString
1+
Set-Alias ctss ConvertTo-SecureString
32
$violationMessage = "File 'AvoidConvertToSecureStringWithPlainText.ps1' uses ConvertTo-SecureString with plaintext. This will expose secure information. Encrypted standard strings should be used instead."
43
$violationName = "PSAvoidUsingConvertToSecureStringWithPlainText"
54
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
@@ -22,4 +21,4 @@ Describe "AvoidConvertToSecureStringWithPlainText" {
2221
$noViolations.Count | Should -Be 0
2322
}
2423
}
25-
}
24+
}

Tests/Rules/AvoidDefaultTrueValueSwitchParameter.tests.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Import-Module PSScriptAnalyzer
2-
$violationMessage = "File 'AvoidDefaultTrueValueSwitchParameter.ps1' has a switch parameter default to true."
1+
$violationMessage = "File 'AvoidDefaultTrueValueSwitchParameter.ps1' has a switch parameter default to true."
32
$violationName = "PSAvoidDefaultValueSwitchParameter"
43
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
54
$violations = Invoke-ScriptAnalyzer $directory\AvoidDefaultTrueValueSwitchParameter.ps1 | Where-Object {$_.RuleName -eq $violationName}
@@ -21,4 +20,4 @@ Describe "AvoidDefaultTrueValueSwitchParameter" {
2120
$noViolations.Count | Should -Be 0
2221
}
2322
}
24-
}
23+
}

Tests/Rules/AvoidDefaultValueForMandatoryParameter.tests.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Import-Module PSScriptAnalyzer
2-
$ruleName = 'PSAvoidDefaultValueForMandatoryParameter'
1+
$ruleName = 'PSAvoidDefaultValueForMandatoryParameter'
32

43
Describe "AvoidDefaultValueForMandatoryParameter" {
54
Context "When there are violations" {
@@ -23,4 +22,4 @@ Describe "AvoidDefaultValueForMandatoryParameter" {
2322
$violations.Count | Should -Be 0
2423
}
2524
}
26-
}
25+
}

Tests/Rules/AvoidEmptyCatchBlock.tests.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Import-Module PSScriptAnalyzer
2-
$violationMessage = "Empty catch block is used. Please use Write-Error or throw statements in catch blocks."
1+
$violationMessage = "Empty catch block is used. Please use Write-Error or throw statements in catch blocks."
32
$violationName = "PSAvoidUsingEmptyCatchBlock"
43
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
54
$violations = Invoke-ScriptAnalyzer $directory\AvoidEmptyCatchBlock.ps1 | Where-Object {$_.RuleName -eq $violationName}
@@ -22,4 +21,4 @@ Describe "UseDeclaredVarsMoreThanAssignments" {
2221
$noViolations.Count | Should -Be 0
2322
}
2423
}
25-
}
24+
}

Tests/Rules/AvoidGlobalAliases.tests.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
22
$testRootDirectory = Split-Path -Parent $directory
33
Import-Module (Join-Path $testRootDirectory 'PSScriptAnalyzerTestHelper.psm1')
4-
Import-Module PSScriptAnalyzer
54

65
$AvoidGlobalAliasesError = "Avoid creating aliases with a Global scope."
76
$violationName = "PSAvoidGlobalAliases"

Tests/Rules/AvoidGlobalFunctions.tests.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
Import-Module PSScriptAnalyzer
2-
3-
$functionErroMessage = "Avoid creating functions with a Global scope."
1+
$functionErroMessage = "Avoid creating functions with a Global scope."
42
$violationName = "PSAvoidGlobalFunctions"
53

64
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path

Tests/Rules/AvoidGlobalOrUnitializedVars.tests.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Import-Module PSScriptAnalyzer
2-
$globalMessage = "Found global variable 'Global:1'."
1+
$globalMessage = "Found global variable 'Global:1'."
32
$globalName = "PSAvoidGlobalVars"
43

54
# PSAvoidUninitializedVariable rule has been deprecated

Tests/Rules/AvoidInvokingEmptyMembers.tests.ps1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
Import-Module PSScriptAnalyzer
2-
3-
$violationMessage = "() has non-constant members. Invoking non-constant members may cause bugs in the script."
1+
$violationMessage = "() has non-constant members. Invoking non-constant members may cause bugs in the script."
42
$violationName = "PSAvoidInvokingEmptyMembers"
53
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
64
$violations = Invoke-ScriptAnalyzer $directory\AvoidInvokingEmptyMembers.ps1 | Where-Object {$_.RuleName -eq $violationName}
@@ -22,4 +20,4 @@ Describe "AvoidInvokingEmptyMembers" {
2220
$noViolations.Count | Should -Be 0
2321
}
2422
}
25-
}
23+
}

Tests/Rules/AvoidNullOrEmptyHelpMessageAttribute.tests.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
Import-Module PSScriptAnalyzer
21
$violationName = "PSAvoidNullOrEmptyHelpMessageAttribute"
32
$violationMessage = "HelpMessage parameter attribute should not be null or empty. To fix a violation of this rule, please set its value to a non-empty string."
43
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
@@ -21,4 +20,4 @@ Describe "AvoidNullOrEmptyHelpMessageAttribute" {
2120
$noViolations.Count | Should -Be 0
2221
}
2322
}
24-
}
23+
}

Tests/Rules/AvoidPositionalParameters.tests.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Import-Module PSScriptAnalyzer
2-
$violationMessage = "Cmdlet 'Get-Command' has positional parameter. Please use named parameters instead of positional parameters when calling a command."
1+
$violationMessage = "Cmdlet 'Get-Command' has positional parameter. Please use named parameters instead of positional parameters when calling a command."
32
$violationName = "PSAvoidUsingPositionalParameters"
43
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
54
$violations = Invoke-ScriptAnalyzer $directory\AvoidPositionalParameters.ps1 | Where-Object {$_.RuleName -eq $violationName}
@@ -27,4 +26,4 @@ Describe "AvoidPositionalParameters" {
2726
$noViolationsDSC.Count | Should -Be 0
2827
}
2928
}
30-
}
29+
}

Tests/Rules/AvoidReservedParams.tests.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Import-Module PSScriptAnalyzer
2-
$violationMessage = [regex]::Escape("Verb-Files' defines the reserved common parameter 'Verbose'.")
1+
$violationMessage = [regex]::Escape("Verb-Files' defines the reserved common parameter 'Verbose'.")
32
$violationName = "PSReservedParams"
43
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
54
$violations = Invoke-ScriptAnalyzer $directory\BadCmdlet.ps1 | Where-Object {$_.RuleName -eq $violationName}
@@ -22,4 +21,4 @@ Describe "AvoidReservedParams" {
2221
$noViolations.Count | Should -Be 0
2322
}
2423
}
25-
}
24+
}

Tests/Rules/AvoidShouldContinueWithoutForce.tests.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Import-Module PSScriptAnalyzer
2-
$violationMessage = "Function 'Verb-Noun2' in file 'AvoidShouldContinueWithoutForce.ps1' uses ShouldContinue but does not have a boolean force parameter. The force parameter will allow users of the script to bypass ShouldContinue prompt"
1+
$violationMessage = "Function 'Verb-Noun2' in file 'AvoidShouldContinueWithoutForce.ps1' uses ShouldContinue but does not have a boolean force parameter. The force parameter will allow users of the script to bypass ShouldContinue prompt"
32
$violationName = "PSAvoidShouldContinueWithoutForce"
43
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
54
$violations = Invoke-ScriptAnalyzer $directory\AvoidShouldContinueWithoutForce.ps1 | Where-Object {$_.RuleName -eq $violationName}

Tests/Rules/AvoidTrailingWhitespace.tests.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
22
$testRootDirectory = Split-Path -Parent $directory
33

4-
Import-Module PSScriptAnalyzer
54
Import-Module (Join-Path $testRootDirectory "PSScriptAnalyzerTestHelper.psm1")
65

76
$ruleName = "PSAvoidTrailingWhitespace"

Tests/Rules/AvoidUnloadableModuleOrMissingRequiredFieldInManifest.tests.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
22
$testRootDirectory = Split-Path -Parent $directory
3-
Import-Module PSScriptAnalyzer
43
Import-Module (Join-Path $testRootDirectory 'PSScriptAnalyzerTestHelper.psm1')
54

65
$missingMessage = "The member 'ModuleVersion' is not present in the module manifest."

Tests/Rules/AvoidUserNameAndPasswordParams.tests.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Import-Module PSScriptAnalyzer
2-
1+
32
$violationMessage = "Function 'TestFunction1' has both Username and Password parameters. Either set the type of the Password parameter to SecureString or replace the Username and Password parameters with a Credential parameter of type PSCredential. If using a Credential parameter in PowerShell 4.0 or earlier, please define a credential transformation attribute after the PSCredential type attribute."
43
$violationName = "PSAvoidUsingUserNameAndPasswordParams"
54
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path

Tests/Rules/AvoidUsingAlias.tests.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ $violationFilepath = Join-Path $directory 'AvoidUsingAlias.ps1'
66
$violations = Invoke-ScriptAnalyzer $violationFilepath | Where-Object {$_.RuleName -eq $violationName}
77
$noViolations = Invoke-ScriptAnalyzer $directory\AvoidUsingAliasNoViolations.ps1 | Where-Object {$_.RuleName -eq $violationName}
88

9-
Import-Module PSScriptAnalyzer
109
Import-Module (Join-Path $testRootDirectory "PSScriptAnalyzerTestHelper.psm1")
1110

1211
Describe "AvoidUsingAlias" {

0 commit comments

Comments
 (0)