PowerShell / PowerShell/PSScriptAnalyzer

PipelineIndentation: when not set to NoIndentation: does not cater for case where line continuation token is used instead of pipeline (->missing indentation)

Open
#1,317 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area - Formatter Issue - Bug
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

foo `
-bar |
baz
foo `
# comment
-bar |
baz

Expected behavior

Calling Invoke-Formatter on it (PipelineIndentation is not NoIndentation, which is not the default), then baz should be indented twice (once because of the previous backtick and once because of the rule itself. It only gets indented once

foo `
    # comment
    -bar |
        baz

Actual behavior

foo `
    # comment
    -bar |
    baz

If an unexpected error was thrown then please report the full error details using e.g. $error[0] | Select-Object *

Environment data

PSSA 1.18,1 or latest version of master

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the examples with Invoke-Formatter using PipelineIndentation rather than NoIndentation, including the backtick continuation and comment. Trace the PipelineIndentation formatting path and verify that baz receives both indentation levels, matching the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.