You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PSUseConsistentIndentation indents inconsistently in function body after param block #1241
Thanks Rob Holt (@rjmholt) for opening this in the correct repo. Psscriptanalyzer is not indening correct after the param block. I've tried to set if to the correct location and PsScriptAnalyzer moving the lies forward.
>$PSVersionTable
Name Value
---------
PSVersion 5.1.18362.1
PSEdition Desktop
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
BuildVersion 10.0.18362.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1>Get-Module-Name PsScriptAnalyzer
ModuleType Version Name ExportedCommands
-------------------------------------
Script 1.18.0 PSScriptAnalyzer {Get-ScriptAnalyzerRule,Invoke-Formatter,Invoke-ScriptAnalyzer}
Saw this problem using IncreaseIndentationAfterEveryPipeline. It will also format correctly if writing the code correctly. I think the problem is that it should first add a new line after each | before formatting. See next comment.
Yes, I would say this issue is resolved. To get the indentation the user must self move the right part to the next line, as per my previous comment. I'm happy with this.
Yes, I tested all examples and they are all resolved in 1.18.1. The fix for it was in PR #1191.
Note that even with the fixes in 1.18.1, people found another edge case, PR 1261 is open for that already.
Activity
ebmarquez commentedon May 13, 2019
Thanks Rob Holt (@rjmholt) for opening this in the correct repo. Psscriptanalyzer is not indening correct after the param block. I've tried to set if to the correct location and PsScriptAnalyzer moving the lies forward.
Example of syntax before: Test.psm1
After PsScriptAnalizer formats the syntax.
msftrncs commentedon May 17, 2019
I think this is similar to #1236, if you turn off the indention for pipe's, it will format this correctly.
johlju commentedon Jun 7, 2019
Saw this problem using
IncreaseIndentationAfterEveryPipeline. It will also format correctly if writing the code correctly.I think the problem is that it should first add a new line after eachSee next comment.|before formatting.Assume this code.
This fails when formatting.
Assume this code
Formats correctly.
johlju commentedon Jun 7, 2019
I think the best solution is if the pipe is followed by something then do not format the pipe.
For Pester tests this would be better too.
Assume this code.
That would end up (if the formatting would work) as
Might not be the preference for tests. So if the user want to have that formatting then the user self must add row breaks after the first pipe.
msftrncs commentedon Jun 14, 2019
The example from Rob Holt (@rjmholt) seems to format correctly now with 1.18.1.
johlju commentedon Jun 17, 2019
Yes, I would say this issue is resolved. To get the indentation the user must self move the right part to the next line, as per my previous comment. I'm happy with this.
bergmeister commentedon Jun 18, 2019
Yes, I tested all examples and they are all resolved in
1.18.1. The fix for it was in PR #1191.Note that even with the fixes in
1.18.1, people found another edge case, PR 1261 is open for that already.