Title: Fixing PSAvoidTrailingWhitespace is broken · Issue #1757 · PowerShell/PSScriptAnalyzer · GitHub
Open Graph Title: Fixing PSAvoidTrailingWhitespace is broken · Issue #1757 · PowerShell/PSScriptAnalyzer
X Title: Fixing PSAvoidTrailingWhitespace is broken · Issue #1757 · PowerShell/PSScriptAnalyzer
Description: Using the Fix option for the PSAvoidTrailingWhitespace rule is broken. Steps to reproduce I have installed PSScriptAnalyzer v1.20.0 using chocolatey and run the following command in this folder: https://github.com/mandiant/VM-Packages/tr...
Open Graph Description: Using the Fix option for the PSAvoidTrailingWhitespace rule is broken. Steps to reproduce I have installed PSScriptAnalyzer v1.20.0 using chocolatey and run the following command in this folder: ht...
X Description: Using the Fix option for the PSAvoidTrailingWhitespace rule is broken. Steps to reproduce I have installed PSScriptAnalyzer v1.20.0 using chocolatey and run the following command in this folder: ht...
Opengraph URL: https://github.com/PowerShell/PSScriptAnalyzer/issues/1757
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fixing PSAvoidTrailingWhitespace is broken","articleBody":"Using the `Fix` option for the `PSAvoidTrailingWhitespace` rule is broken.\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\nI have installed PSScriptAnalyzer v1.20.0 using chocolatey and run the following command in this folder: https://github.com/mandiant/VM-Packages/tree/2726fcde4bba996dcd446b240c3439a129ddba7d/packages\r\n\r\n```PowerShell\r\nInvoke-ScriptAnalyzer . -Recurse -IncludeRule PSAvoidTrailingWhitespace -Fix\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\nI had expected this command to fix the offenses of the `PSAvoidTrailingWhitespace` rule.\r\n\r\nActual behavior\r\n---------------\r\nIt removes `}` causing a `MissingEndCurlyBrace` parsing error, as you can see in the `git diff`:\r\n\r\n\r\nAn `\u003cU+FEFF>` is also added at the beginning of the modified files. This seems related to https://github.com/PowerShell/PSScriptAnalyzer/issues/1743\r\n\r\nEnvironment data\r\n----------------\r\n\r\n\u003c!-- Provide the output of the following 2 commands -->\r\n\r\n```PowerShell\r\n> $PSVersionTable\r\n\r\nName Value\r\n---- -----\r\nPSVersion 5.1.14409.1005\r\nPSEdition Desktop\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nBuildVersion 10.0.14409.1005\r\nCLRVersion 4.0.30319.42000\r\nWSManStackVersion 3.0\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\n\r\n> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }\r\n1.20.0\r\n```\r\n\r\n","author":{"url":"https://github.com/Ana06","@type":"Person","name":"Ana06"},"datePublished":"2021-12-21T13:21:54Z","url":"https://github.com/PowerShell/PSScriptAnalyzer/issues/1757"}
| 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:16878767-d1ac-a3f6-bd47-35c6405c784b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AD54:124C2B:1FD9C6:2A2A85:6AFD023F |
| html-safe-nonce | 5ea3d5e29ec9395d58bb2a4eca88cd9663223a26f0baeff16a680d29cd922b0e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRDU0OjEyNEMyQjoxRkQ5QzY6MkEyQTg1OjZBRkQwMjNGIiwidmlzaXRvcl9pZCI6Ijc5MDczMTk2NTMxNDE5MDU5ODMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 120a27767ebed1420d072d6a3ec3581fd74959cc4c996d2a340fe16a90525e38 |
| hovercard-subject-tag | issue:1085828635 |
| 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/1757/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7faf40bed481b4d99b17e42fb0b868c413e4b81faa5738be21bb94a60b077707/PowerShell/PSScriptAnalyzer/issues/1757 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7faf40bed481b4d99b17e42fb0b868c413e4b81faa5738be21bb94a60b077707/PowerShell/PSScriptAnalyzer/issues/1757 |
| og:image:alt | Using the Fix option for the PSAvoidTrailingWhitespace rule is broken. Steps to reproduce I have installed PSScriptAnalyzer v1.20.0 using chocolatey and run the following command in this folder: ht... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Ana06 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 8fd5a24ae29aa78df114eaaf1f9a839e8c3b7c0d27549e4f54678bb7cf3166d4 |
| 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 | dd0990b833f227378ab84f1d9519db1a04660550 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width