|
1 | | -Import-Module ScriptAnalyzer |
| 1 | +Import-Module PSScriptAnalyzer |
2 | 2 | $sa = Get-Command Invoke-ScriptAnalyzer |
3 | 3 | $directory = Split-Path -Parent $MyInvocation.MyCommand.Path |
4 | 4 | $singularNouns = "PSUseSingularNouns" |
@@ -26,16 +26,6 @@ Describe "Test available parameters" { |
26 | 26 | } |
27 | 27 | } |
28 | 28 |
|
29 | | - Context "LoggerPath parameters" { |
30 | | - It "has a LoggerPath parameter" { |
31 | | - $params.ContainsKey("LoggerPath") | Should Be $true |
32 | | - } |
33 | | - |
34 | | - It "accepts string array" { |
35 | | - $params["LoggerPath"].ParameterType.FullName | Should Be "System.String[]" |
36 | | - } |
37 | | - } |
38 | | - |
39 | 29 | Context "IncludeRule parameters" { |
40 | 30 | It "has an IncludeRule parameter" { |
41 | 31 | $params.ContainsKey("IncludeRule") | Should Be $true |
@@ -72,21 +62,21 @@ Describe "Test Path" { |
72 | 62 | } |
73 | 63 |
|
74 | 64 | Context "When given a directory" { |
75 | | - $withoutPathWithDirectory = Invoke-ScriptAnalyzer $directory\RecursionDirectoryTest |
76 | | - $withPathWithDirectory = Invoke-ScriptAnalyzer -Path $directory\RecursionDirectoryTest |
| 65 | + $withoutPathWithDirectory = Invoke-ScriptAnalyzer -Recurse $directory\RecursionDirectoryTest |
| 66 | + $withPathWithDirectory = Invoke-ScriptAnalyzer -Recurse -Path $directory\RecursionDirectoryTest |
77 | 67 |
|
78 | 68 | It "Has the same count as without Path parameter"{ |
79 | 69 | $withoutPathWithDirectory.Count -eq $withPathWithDirectory.Count | Should Be $true |
80 | 70 | } |
81 | 71 |
|
82 | | - It "Analyzes all the file" { |
| 72 | + It "Analyzes all the files" { |
83 | 73 | $globalVarsViolation = $withPathWithDirectory | Where-Object {$_.RuleName -eq "PSAvoidGlobalVars"} |
84 | 74 | $clearHostViolation = $withPathWithDirectory | Where-Object {$_.RuleName -eq "PSAvoidUsingClearHost"} |
85 | 75 | $writeHostViolation = $withPathWithDirectory | Where-Object {$_.RuleName -eq "PSAvoidUsingWriteHost"} |
86 | 76 | Write-Output $globalVarsViolation.Count |
87 | 77 | Write-Output $clearHostViolation.Count |
88 | 78 | Write-Output $writeHostViolation.Count |
89 | | - $globalVarsViolation.Count -eq 1 -and $clearHostViolation.Count -eq 1 -and $writeHostViolation.Count -eq 1 | Should Be $true |
| 79 | + $globalVarsViolation.Count -eq 1 -and $writeHostViolation.Count -eq 1 | Should Be $true |
90 | 80 | } |
91 | 81 |
|
92 | 82 | } |
@@ -151,12 +141,12 @@ Describe "Test Exclude And Include" { |
151 | 141 | Describe "Test Severity" { |
152 | 142 | Context "When used correctly" { |
153 | 143 | It "works with one argument" { |
154 | | - $errors = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -Severity Strict |
| 144 | + $errors = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -Severity Information |
155 | 145 | $errors.Count | Should Be 0 |
156 | 146 | } |
157 | 147 |
|
158 | 148 | It "works with 2 arguments" { |
159 | | - $errors = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -Severity Strict, Warning |
| 149 | + $errors = Invoke-ScriptAnalyzer $directory\TestScript.ps1 -Severity Information, Warning |
160 | 150 | $errors.Count | Should Be 2 |
161 | 151 | } |
162 | 152 | } |
|
0 commit comments