Fix PSUseConsistentIndentation.PipelineIndentation.None to not remove code when the previous line ended with a pipe by bergmeister · Pull Request #1746 · PowerShell/PSScriptAnalyzer
Yes, testing is always a challenge. It's a compromise between doing lots of integration tests or complex code and maintaining all the test cases if a change necessitates updating expectations. Definitely happy to add more test cases or something more complex, do you have something specific in mind? Otherwise my suggestions is to dog food the local build with this setting.
With regards to the repro also working for 3, this is in fact the same setting, it is just the enum representation of it:
| [ConfigurableRuleProperty(defaultValue: "IncreaseIndentationForFirstPipeline")] | |
| public string PipelineIndentation | |
| { | |
| get | |
| { | |
| return pipelineIndentationStyle.ToString(); | |
| } | |
| set | |
| { | |
| if (String.IsNullOrWhiteSpace(value) || | |
| !Enum.TryParse(value, true, out pipelineIndentationStyle)) | |
| { | |
| pipelineIndentationStyle = PipelineIndentationStyle.IncreaseIndentationForFirstPipeline; | |
| } | |
| } | |
| } | |
| private bool insertSpaces; | |
| private char indentationChar; | |
| private int indentationLevelMultiplier; | |
| // TODO Enable auto when the rule is able to detect indentation | |
| private enum IndentationKind { | |
| Space, | |
| Tab, | |
| // Auto | |
| }; | |
| private enum PipelineIndentationStyle | |
| { | |
| IncreaseIndentationForFirstPipeline, | |
| IncreaseIndentationAfterEveryPipeline, | |
| NoIndentation, | |
| None | |
| } |