Title: Invoke-Formatter is not idempotent on `--%` verbatim arguments · Issue #2209 · PowerShell/PSScriptAnalyzer · GitHub
Open Graph Title: Invoke-Formatter is not idempotent on `--%` verbatim arguments · Issue #2209 · PowerShell/PSScriptAnalyzer
X Title: Invoke-Formatter is not idempotent on `--%` verbatim arguments · Issue #2209 · PowerShell/PSScriptAnalyzer
Description: Steps to reproduce Run the formatter repeatedly on a native command that uses the stop-parsing token: $formatted = $null 1..3 | ForEach-Object { $formatted = Invoke-Formatter ($formatted ?? 'cmd --% raw | text & stuff') $formatted } Expe...
Open Graph Description: Steps to reproduce Run the formatter repeatedly on a native command that uses the stop-parsing token: $formatted = $null 1..3 | ForEach-Object { $formatted = Invoke-Formatter ($formatted ?? 'cmd --...
X Description: Steps to reproduce Run the formatter repeatedly on a native command that uses the stop-parsing token: $formatted = $null 1..3 | ForEach-Object { $formatted = Invoke-Formatter ($formatted ?? 'cm...
Opengraph URL: https://github.com/PowerShell/PSScriptAnalyzer/issues/2209
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Invoke-Formatter is not idempotent on `--%` verbatim arguments","articleBody":"Steps to reproduce\n------------------\n\nRun the formatter repeatedly on a native command that uses the stop-parsing token:\n\n```powershell\n$formatted = $null\n1..3 | ForEach-Object {\n $formatted = Invoke-Formatter ($formatted ?? 'cmd --% raw | text & stuff')\n $formatted\n}\n```\n\nExpected behavior\n-----------------\n\nFormatting already formatted output should be a no-op. Spacing adjacent to the verbatim argument should either be left untouched or normalized once to a stable result.\n\nActual behavior\n---------------\n\nOne additional space is inserted before `|` on every run:\n\n```text\ncmd --% raw | text & stuff\ncmd --% raw | text & stuff\ncmd --% raw | text & stuff\n```\n\nThe output grows without bound in a format-on-save loop.\n\nThe verbatim-argument token owns the text up to the pipe. `PSUseConsistentWhitespace` with `CheckPipe` sees a zero-width gap before `|` and inserts a space inside the verbatim argument's extent on each formatting pass.\n\nEnvironment data\n----------------\n\nReproduced with:\n\n- PSScriptAnalyzer 1.25.0 on PowerShell 7.5.2\n- PSScriptAnalyzer 1.25.0 on PowerShell 7.6.3\n- PSScriptAnalyzer built from `main` at PowerShell/PSScriptAnalyzer@4b0117ca7d2887711c9699f467ba7171f8859156 on PowerShell 7.6.4\n","author":{"url":"https://github.com/kjanat","@type":"Person","name":"kjanat"},"datePublished":"2026-08-24T15:54:32Z","url":"https://github.com/PowerShell/PSScriptAnalyzer/issues/2209"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e2eb93b2-0167-128a-cfa3-a99846c8d986 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C830:2DF659:A38D:D8AC:6AFCD7D0 |
| html-safe-nonce | dcd758071c3efd89ebdaae06119bf56c66d55f2db425593f5a2239fbde9a4736 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODMwOjJERjY1OTpBMzhEOkQ4QUM6NkFGQ0Q3RDAiLCJ2aXNpdG9yX2lkIjoiNDg5NDY0MzA5NTY1NzU2ODIwOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | db0c2067c631a097ed237f0a1e886a2d7fc5057abfe2b9ea0e9da91429cc5656 |
| hovercard-subject-tag | issue:5236775994 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PSScriptAnalyzer/2209/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8277923620b30c51626066e51e4480bcd0d6a35da1453574b6fcf0a08e24cd5f/PowerShell/PSScriptAnalyzer/issues/2209 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8277923620b30c51626066e51e4480bcd0d6a35da1453574b6fcf0a08e24cd5f/PowerShell/PSScriptAnalyzer/issues/2209 |
| og:image:alt | Steps to reproduce Run the formatter repeatedly on a native command that uses the stop-parsing token: $formatted = $null 1..3 | ForEach-Object { $formatted = Invoke-Formatter ($formatted ?? 'cmd --... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kjanat |
| hostname | github.com |
| expected-hostname | github.com |
| None | b5b7bc7e41e0a604bbdb5035c7ed9620c2d28b9c8a18747182e2262a75abfd91 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PSScriptAnalyzer git https://github.com/PowerShell/PSScriptAnalyzer.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 33149177 |
| octolytics-dimension-repository_nwo | PowerShell/PSScriptAnalyzer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 33149177 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PSScriptAnalyzer |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ff5022cc3aa767e6115451d9c322dd975506d40e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width