File tree 2 files changed +4
-3
lines changed
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)
390
390
testAst => testAst is CommandAst , true ) ;
391
391
foreach ( CommandAst commandAst in commandAsts )
392
392
{
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 ( ) ;
394
395
for ( int i = 0 ; i < commandParameterAstElements . Count - 1 ; i ++ )
395
396
{
396
397
IScriptExtent leftExtent = commandParameterAstElements [ i ] . Extent ;
Original file line number Diff line number Diff line change @@ -474,11 +474,11 @@ bar -h i `
474
474
}
475
475
476
476
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" '
478
478
Invoke-Formatter - ScriptDefinition $def |
479
479
Should - BeExactly $def - Because ' CheckParameter configuration is not turned on by default (yet) as the setting is new'
480
480
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" '
482
482
}
483
483
484
484
It " Should fix script when newlines are involved" {
You can’t perform that action at this time.
0 commit comments