File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -390,7 +390,8 @@ private IEnumerable<DiagnosticRecord> FindParameterViolations(Ast ast)
390390 testAst => testAst is CommandAst , true ) ;
391391 foreach ( CommandAst commandAst in commandAsts )
392392 {
393- List < Ast > commandParameterAstElements = commandAst . FindAll ( testAst => true , searchNestedScriptBlocks : false ) . ToList ( ) ;
393+ List < Ast > commandParameterAstElements = commandAst . FindAll (
394+ testAst => testAst . Parent == commandAst , searchNestedScriptBlocks : false ) . ToList ( ) ;
394395 for ( int i = 0 ; i < commandParameterAstElements . Count - 1 ; i ++ )
395396 {
396397 IScriptExtent leftExtent = commandParameterAstElements [ i ] . Extent ;
Original file line number Diff line number Diff line change @@ -474,11 +474,11 @@ bar -h i `
474474 }
475475
476476 It " Should fix script to always have 1 space between parameters except when using colon syntax but not by default" {
477- $def = ' foo -bar $baz -ParameterName: $ParameterValue'
477+ $def = ' foo -bar $baz -ParameterName: $ParameterValue "$PSScriptRoot\module.psd1" '
478478 Invoke-Formatter - ScriptDefinition $def |
479479 Should - BeExactly $def - Because ' CheckParameter configuration is not turned on by default (yet) as the setting is new'
480480 Invoke-Formatter - ScriptDefinition $def - Settings $settings |
481- Should - BeExactly ' foo -bar $baz -ParameterName: $ParameterValue'
481+ Should - BeExactly ' foo -bar $baz -ParameterName: $ParameterValue "$PSScriptRoot\module.psd1" '
482482 }
483483
484484 It " Should fix script when newlines are involved" {
You can’t perform that action at this time.
0 commit comments