PSScriptAnalyzer
PSScriptAnalyzer copied to clipboard
Normalisation of new lines after pipes in expressions with 2 or more pipes
Summary of the new feature
Consider the following
$List | Where-Object {
} |
ForEach-Object {
}
This is a formatted piece of PowerShell with the notable feature of using both no new line after the pipe and new line after the pipe. The new rule would normalise the presence of a new line after a pipe across the input data. The rule would have the option to enforce new lines or enforce no new lines after a pipe.
For example,
$List | Where-Object {
} |
ForEach-Object {
}
would become
$List | Where-Object {
} | ForEach-Object {
}
If there only exists one pipe, then removing a Newline pending its line length could also be within the scope of the feature.
What is the latest version of PSScriptAnalyzer at the point of writing
PS > (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() } 1.19.1