◐ Shell
clean mode source ↗

Split CheckPipe feature of trimming redundant whitespace out into option CheckPipeForRedundantWhitespace by bergmeister · Pull Request #1413 · PowerShell/PSScriptAnalyzer

@bergmeister

PR Summary

This is because some people align their pipes (e.g. in Pester tests) and don't want redundant white-space to be trimmed.
Therefore the concern of the rule options is split into 2 areas:

  • Checkpipe still corrects when there is no whitespace around the pipe operator
  • The new CheckPipeForRedundantWhiteSpace option is for cases where redundant whitespace needs to be trimmed. Disabled by default.

PR Checklist

…ion CheckPipeForRedundantWhiteSpace

Christoph Bergmeister added 2 commits

February 10, 2020 09:42

rjmholt


#### CheckPipeForRedundantWhitespace : bool (Default value is `$false`)

Checks if a pipe is surrounded by redundant whitespace (i.e. more than 1 whitespace). E.g. `foo | bar` instead of `foo|bar`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the example here accurate? Or is it something like:

vs

(GitHub seems to normalise spaces in inline code...)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right, I forgot to update the example as well.

bergmeister

@bergmeister bergmeister changed the title Split CheckPipe feature of trimming redundant whitespace out into option CheckPipeForRedundantWhiteSpace Split CheckPipe feature of trimming redundant whitespace out into option CheckPipeForRedundantWhitespace

Feb 11, 2020