PowerShell / PSScriptAnalyzer

Download ScriptAnalyzer from PowerShellGallery
https://www.powershellgallery.com/packages/PSScriptAnalyzer/
MIT License
1.85k stars 373 forks source link

Fix edge case of UseConsistentIndentation where child pipeline is on the same line as hashtable #1838

Closed bergmeister closed 2 years ago

bergmeister commented 2 years ago

PR Summary

Fixes #1832

During debugging I found that the root cause of the issue was that in MatchingPipelineAstEnd function, the wrong pipeline was being matched (it was the child and not parent pipeline), which lead to de-indentation to be skipped and ending up with one indentation level too much. Therefore removing this ref counter, which is a premature optimisation I have to admit to avoid looping over all pipeline asts every time and can be removed.

PR Checklist