Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Engine/FindAstPositionVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public override AstVisitAction VisitTypeDefinition(TypeDefinitionAst typeDefinit

public override AstVisitAction VisitUsingStatement(UsingStatementAst usingStatementAst)
{
return Visit(usingStatementAst);
return AstVisitAction.Continue;
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion NuGet.Config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
Expand Down
17 changes: 15 additions & 2 deletions Tests/Rules/UseConsistentWhitespace.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,19 @@ $ht = @{
$ruleConfiguration.CheckSeparator = $false
$ruleConfiguration.IgnoreAssignmentOperatorInsideHashTable = $true
}

It "Should not find violation if assignment operator is in multi-line hash table and a using statement is present" {
$def = @'
using namespace System.IO

$ht = @{
variable = 3
other = 4
}
'@
Invoke-ScriptAnalyzer -ScriptDefinition $def -Settings $settings | Should -Be $null
}

It "Should not find violation if assignment operator is in multi-line hash table" {
$def = @'
$ht = @{
Expand Down Expand Up @@ -628,11 +641,11 @@ bar -h i `
}

It "Should fix script when a parameter value is a script block spanning multiple lines" {
$def = {foo {
$def = {foo {
bar
} -baz}

$expected = {foo {
$expected = {foo {
bar
} -baz}
Invoke-Formatter -ScriptDefinition "$def" -Settings $settings |
Expand Down