File tree 4 files changed +26
-5
lines changed
4 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -279,8 +279,9 @@ protected override void BeginProcessing()
279
279
this . SessionState ,
280
280
recurseCustomRulePath ) ;
281
281
282
- if ( IsFileParameterSet ( ) )
282
+ if ( IsFileParameterSet ( ) && Path != null )
283
283
{
284
+ // just used to obtain the directory to use to find settings below
284
285
ProcessPath ( ) ;
285
286
}
286
287
@@ -350,6 +351,11 @@ protected override void ProcessRecord()
350
351
return ;
351
352
}
352
353
354
+ if ( IsFileParameterSet ( ) )
355
+ {
356
+ ProcessPath ( ) ;
357
+ }
358
+
353
359
#if ! PSV3
354
360
// TODO Support dependency resolution for analyzing script definitions
355
361
if ( saveDscDependency )
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ if (-not (Test-PSEditionCoreCLR))
9
9
$null , " Wow6432Node" | ForEach-Object {
10
10
try
11
11
{
12
- Set-ItemProperty - Name " DisablePromptToUpdateHelp" - Path " HKLM:\SOFTWARE\$ ( $_ ) \Microsoft\PowerShell" - Value 1 - Force
12
+ Set-ItemProperty - Name " DisablePromptToUpdateHelp" - Path " HKLM:\SOFTWARE\$ ( $_ ) \Microsoft\PowerShell" - Value 1 - Force - ErrorAction SilentlyContinue
13
13
}
14
14
catch
15
15
{
@@ -66,7 +66,7 @@ Describe "Test importing correct customized rules" {
66
66
$null , " Wow6432Node" | ForEach-Object {
67
67
try
68
68
{
69
- Set-ItemProperty - Name " DisablePromptToUpdateHelp" - Path " HKLM:\SOFTWARE\$ ( $_ ) \Microsoft\PowerShell" - Value 1 - Force
69
+ Set-ItemProperty - Name " DisablePromptToUpdateHelp" - Path " HKLM:\SOFTWARE\$ ( $_ ) \Microsoft\PowerShell" - Value 1 - Force - EA SilentlyContinue
70
70
}
71
71
catch
72
72
{
Original file line number Diff line number Diff line change @@ -180,7 +180,22 @@ Describe "Test Path" {
180
180
Remove-PSDrive $freeDriveName
181
181
$numFilesResult | Should - Be $numFilesExpected
182
182
}
183
- }
183
+ }
184
+
185
+ Context " When piping in files" {
186
+ It " Can be piped in from a string" {
187
+ $piped = (" $directory \TestScript.ps1" | Invoke-ScriptAnalyzer )
188
+ $explicit = Invoke-ScriptAnalyzer - Path $directory \TestScript.ps1
189
+
190
+ $piped.Count | Should Be $explicit.Count
191
+ }
192
+
193
+ It " Can be piped from Get-ChildItem" {
194
+ $piped = ( Get-ChildItem - Path $directory - Filter TestTestPath* .ps1 | Invoke-ScriptAnalyzer )
195
+ $explicit = Invoke-ScriptAnalyzer - Path $directory \TestTestPath* .ps1
196
+ $piped.Count | Should Be $explicit.Count
197
+ }
198
+ }
184
199
}
185
200
186
201
Context " When given a directory" {
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ $testingLibraryUsage = $true
191
191
$null , " Wow6432Node" | ForEach-Object {
192
192
try
193
193
{
194
- Set-ItemProperty - Name " DisablePromptToUpdateHelp" - Path " HKLM:\SOFTWARE\$ ( $_ ) \Microsoft\PowerShell" - Value 1 - Force
194
+ Set-ItemProperty - Name " DisablePromptToUpdateHelp" - Path " HKLM:\SOFTWARE\$ ( $_ ) \Microsoft\PowerShell" - Value 1 - Force - ErrorAction SilentlyContinue
195
195
}
196
196
catch
197
197
{
You can’t perform that action at this time.
0 commit comments