Skip to content

Normalisation of new lines after pipes in expressions with 2 or more pipes #1755

Open
@iadcode

Description

@iadcode

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions