Skip to content

Commit

Permalink
UseCorrectCasing: Preserve script paths
Browse files Browse the repository at this point in the history
  • Loading branch information
bergmeister committed Jun 6, 2019
1 parent c23bf1c commit 6c891b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Rules/UseCorrectCasing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public override IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string file
}

var commandInfo = Helper.Instance.GetCommandInfo(commandName);
if (commandInfo == null)
if (commandInfo == null || commandInfo.CommandType == CommandTypes.ExternalScript)
{
continue;
}
Expand Down
7 changes: 7 additions & 0 deletions Tests/Rules/UseCorrectCasing.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,11 @@ Describe "UseCorrectCasing" {
}
Invoke-Formatter 'invoke-dummyFunction' | Should -Be 'Invoke-DummyFunction'
}

It "preserves script paths" -Skip:($IsLinux -or $IsMacOS) {
$uncPath = [System.IO.Path]::Combine("\\$(HOSTNAME.EXE)\C$\", $TestDrive, "$(New-Guid).ps1")
New-Item -ItemType File -Path $uncPath
$scriptDefinition = ". $uncPath"
Invoke-Formatter $scriptDefinition | Should -Be $scriptDefinition
}
}

0 comments on commit 6c891b6

Please sign in to comment.