Title: The PSAvoidTrailingWhitespace rule is not applied when using Invoke-Formatter · Issue #1992 · PowerShell/PSScriptAnalyzer · GitHub
Open Graph Title: The PSAvoidTrailingWhitespace rule is not applied when using Invoke-Formatter · Issue #1992 · PowerShell/PSScriptAnalyzer
X Title: The PSAvoidTrailingWhitespace rule is not applied when using Invoke-Formatter · Issue #1992 · PowerShell/PSScriptAnalyzer
Description: Steps to reproduce Using Invoke-Formatter does not apply the PSAvoidTrailingWhitespace rule as shown by the following example script: $script = @" Function Get-Example { 'Example' } "@ $settings = @{ IncludeRules = @("PSAvoidTrailingWhit...
Open Graph Description: Steps to reproduce Using Invoke-Formatter does not apply the PSAvoidTrailingWhitespace rule as shown by the following example script: $script = @" Function Get-Example { 'Example' } "@ $settings = ...
X Description: Steps to reproduce Using Invoke-Formatter does not apply the PSAvoidTrailingWhitespace rule as shown by the following example script: $script = @" Function Get-Example { 'Example' } &q...
Opengraph URL: https://github.com/PowerShell/PSScriptAnalyzer/issues/1992
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The PSAvoidTrailingWhitespace rule is not applied when using Invoke-Formatter","articleBody":"Steps to reproduce\r\n------------------\r\nUsing `Invoke-Formatter` does not apply the `PSAvoidTrailingWhitespace ` rule as shown by the following example script:\r\n\r\n```PowerShell\r\n$script = @\"\r\nFunction Get-Example { \r\n 'Example' \r\n} \r\n\"@\r\n\r\n$settings = @{\r\n\tIncludeRules = @(\"PSAvoidTrailingWhitespace\")\r\n}\r\n\r\n$formatted = Invoke-Formatter -ScriptDefinition $script -Settings $settings\r\n\r\nOut-File -FilePath ./result.ps1 -InputObject $formatted -Encoding utf8 -NoNewline\r\n\r\nInvoke-ScriptAnalyzer -Path ./result.ps1\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\n```none\r\n# There should be no linting results after formatting\r\n```\r\n\r\nActual behavior\r\n---------------\r\n\r\n```none\r\n# There are linting results even after formatting\r\nRuleName Severity ScriptName Line Message\r\n-------- -------- ---------- ---- -------\r\nPSAvoidTrailingWhitespace Information result.ps1 1 Line has trailing whitespace\r\nPSAvoidTrailingWhitespace Information result.ps1 2 Line has trailing whitespace\r\nPSAvoidTrailingWhitespace Information result.ps1 3 Line has trailing whitespace\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n\r\n```PowerShell\r\n> $PSVersionTable\r\nName Value\r\n---- -----\r\nPSVersion 5.1.22621.2506\r\nPSEdition Desktop\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nBuildVersion 10.0.22621.2506\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.22.0\r\n```\r\n","author":{"url":"https://github.com/Ju-l1a","@type":"Person","name":"Ju-l1a"},"datePublished":"2024-04-09T10:10:26Z","url":"https://github.com/PowerShell/PSScriptAnalyzer/issues/1992"}
| 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:f34b6c0d-2ed6-99b9-0f36-68d6d4cb4096 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E862:AF075:43E412:599C03:6AFCEAC9 |
| html-safe-nonce | d08484614d19f5e6b96faf1ff3d653562647e05c8cc142f676a33abb259adb85 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODYyOkFGMDc1OjQzRTQxMjo1OTlDMDM6NkFGQ0VBQzkiLCJ2aXNpdG9yX2lkIjoiNzU3MDE2ODA3OTA3MDMyNTQ0OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 11ca5ca995ce792794c39cd20ee4eb7d7ae1f8450e74b1c6e851d0d2bbe55bde |
| hovercard-subject-tag | issue:2233091169 |
| 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/1992/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d81ed3825f2790140db46f660ceb049d2c55407b076d950353d702866cf43409/PowerShell/PSScriptAnalyzer/issues/1992 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d81ed3825f2790140db46f660ceb049d2c55407b076d950353d702866cf43409/PowerShell/PSScriptAnalyzer/issues/1992 |
| og:image:alt | Steps to reproduce Using Invoke-Formatter does not apply the PSAvoidTrailingWhitespace rule as shown by the following example script: $script = @" Function Get-Example { 'Example' } "@ $settings = ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Ju-l1a |
| hostname | github.com |
| expected-hostname | github.com |
| None | 99aede4c5f55ec5cf06666a8c9e03ebf9f85f7231223e7f1c38c16e5504835b3 |
| 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 | ecfd63ca125ec74b42f74eeb158b3fa081c8c497 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width