FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix PSCloseBrace rule to not wrongly flag closing brace of one-line hashtable, which lead to incorrect formatting by bergmeister · Pull Request #1309 · PowerShell/PSScriptAnalyzer · GitHub

Fix PSCloseBrace rule to not wrongly flag closing brace of one-line hashtable, which lead to incorrect formatting - #1309

Merged
Christoph Bergmeister (bergmeister) merged 7 commits into
PowerShell:masterfrom
bergmeister:FixCloseBraceToIgnoreHashtable
Aug 19, 2019
Merged

Fix PSCloseBrace rule to not wrongly flag closing brace of one-line hashtable, which lead to incorrect formatting#1309
Christoph Bergmeister (bergmeister) merged 7 commits into
PowerShell:masterfrom
bergmeister:FixCloseBraceToIgnoreHashtable

Conversation

Christoph Bergmeister (bergmeister) commented Aug 15, 2019
edited
Loading

Copy link
Copy Markdown
Collaborator

PR Summary

Fixes #1284

This fixes a bug (that must've been long-standing) in the GetBracePairs method (which returns all pairs of braces except for hashtables) of the TokenOperations class where it can wrongly pair an RBrace of an hashtable with the LCurly of a braced expression. This caused incorrect formatting of the script definition if ($true) { $test = @{ } } where the selected RBrace was the one of the hashtable and not the ifexpression, therefore leading to an incorrectly added newline before the final brace by the PSCloseBrace rule used by Invoke-Formatter (default rules settings are such that one-line expressions do not require a newline before the closing brace).

PR Checklist

Christoph Bergmeister (bergmeister) changed the title Fix PSCloseBrace rule to not wrongly flag one-line hashtable closing brace Fix PSCloseBrace rule to not wrongly flag closing brace of one-line hashtable, which lead to incorrect formatting Aug 17, 2019
Christoph Bergmeister (bergmeister) marked this pull request as ready for review August 17, 2019 15:50
Comment thread Engine/TokenOperations.cs Outdated
Comment thread Engine/TokenOperations.cs Outdated
Comment thread Engine/TokenOperations.cs
Co-Authored-By: Robert Holt <rjmholt@gmail.com>
Christoph Bergmeister (bergmeister) merged commit 4f82d81 into PowerShell:master Aug 19, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

codeFormatting.IgnoreOneLineBlock / hashtable problem

2 participants


Back | FazBrowse Home | New Git URL