GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Preserve Invoke-Formatter idempotence for `--%` arguments by Copilot · Pull Request #2265 · PowerShell/PSScriptAnalyzer

Conversation

Copilot AI commented Oct 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Repeated formatting of cmd --% raw | text & stuff inserts another space before | on every pass. The parser includes trailing whitespace in the verbatim argument token, causing PSUseConsistentWhitespace to misidentify a missing separator.

  • Boundary handling: Skip pre-pipe spacing corrections immediately after a --% verbatim argument. Continue formatting whitespace after that pipe and around other pipes.
  • Regression coverage: Check repeated formatting with zero, multiple, and tab spacing, plus empty verbatim arguments and redundant-whitespace mode.
# Remains unchanged across formatting passes:
cmd --% raw | text & stuff
  • Fixes Invoke-Formatter is not idempotent on --% verbatim arguments #2209

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Initial plan
29b8759
Copilot AI assigned Copilot and Christoph Bergmeister (bergmeister) Oct 27, 2026
Copilot started work on behalf of Christoph Bergmeister (bergmeister) October 27, 2026 22:30
View session
Copilot AI linked an issue Oct 27, 2026 that may be closed by this pull request
Invoke-Formatter is not idempotent on --% verbatim arguments #2209
Open
@bergmeister
Preserve verbatim argument spacing before pipes
82b8f3d
Co-authored-by: bergmeister <[email protected]>
Copilot AI changed the title [WIP] Fix Invoke-Formatter idempotency issue with --% verbatim arguments Preserve Invoke-Formatter idempotence for --% arguments Oct 27, 2026
Copilot finished work on behalf of Christoph Bergmeister (bergmeister) October 27, 2026 22:38
Copilot AI requested a review from Christoph Bergmeister (bergmeister) October 27, 2026 22:38
@bergmeister
Christoph Bergmeister (bergmeister) requested a balanced review from Copilot October 28, 2026 07:17
Copilot started reviewing on behalf of Christoph Bergmeister (bergmeister) October 28, 2026 07:18
View session
Copilot AI reviewed Oct 28, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the fix preserving verbatim-argument whitespace before pipes.

No open issues 🎉

What changed in this PR

Addresses #2209 by preventing Invoke-Formatter from repeatedly inserting spaces before pipes following --% verbatim arguments.

Changes:

  • Skip pre-pipe whitespace corrections after verbatim arguments while preserving formatting after the pipe and around other pipes.
  • Add repeated-formatting regression tests for zero, multiple, and tab spacing, plus empty verbatim arguments.
  • Verify redundant-whitespace mode preserves verbatim whitespace while correcting spacing after the pipe.
File Description
Tests/​Rules/​UseConsistentWhitespace.tests.ps1 Tests surrounding pipe formatting and redundant-whitespace handling.
Tests/​Engine/​InvokeFormatter.tests.ps1 Tests verbatim argument preservation across repeated formatting passes.
Rules/​UseConsistentWhitespace.cs Skips pre-pipe spacing corrections immediately after verbatim arguments.

Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bergmeister
Christoph Bergmeister (bergmeister) marked this pull request as ready for review October 28, 2026 07:23
@bergmeister
Christoph Bergmeister (bergmeister) requested a review from a team as a code owner October 28, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@bergmeister Christoph Bergmeister (bergmeister) Awaiting requested review from bergmeister bergmeister is a code owner

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@bergmeister Christoph Bergmeister (bergmeister)

Copilot code review Copilot

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Invoke-Formatter is not idempotent on --% verbatim arguments

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@bergmeister
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.