| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…dered by the formatter
…character, followed by multiple white-spaces were truncated when fixed/formatted
…ormatter with PSAvoidTrailingWhitespace and also checking that single-character lines that have trailing whitespace are not removed
There was a problem hiding this comment.
It works as expected now and all tests pass. Looks good to me!
Sorry, something went wrong.
|
I don't know if this is to do with this issue specifically but I've found that with this branch the fix for PSAvoidTrailingWhitespace gets applied when using Invoke-ScriptAnalyzer -Fix ... but not when using Invoke-Formatter .... I don't seem to have this problem for any other rules I've tried. Edit: actually I'm getting the same for PSPossibleIncorrectComparisonWithNull. |
Sorry, something went wrong.
|
Hey Ju-l1a 👋, You need to tell the formatter to include that rule when carrying out the formatting. $Settings = @{
IncludeRules = @("PSAvoidTrailingWhitespace")
Rules = @{
"PSAvoidTrailingWhitespace" = @{}
}
}So the below code, with lots of trailing whitespace: $ScriptDef = @"
Function Get-Example {
'Example'`t`t`t
}`t`t`t
"@Is not altered when running: Invoke-Formatter -ScriptDefinition $ScriptDefBut is fixed when running: Invoke-Formatter -ScriptDefinition $ScriptDef -Settings $SettingsHope that helps! |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks! Sorry it took so long to get to these.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
Added PSAvoidTrailingWhitespace to the list of rules considered by the formatter (an entry for the rule is still required in the Rules part of settings).
Fixes The PSAvoidTrailingWhitespace rule is not applied when using Invoke-Formatter #1992
Fixed an issue where lines starting with and containing a single character, that have trailing white-space, are truncated when formatted/fixed. See comment in #1992 for explanation.
Fixes Fixing PSAvoidTrailingWhitespace is broken #1757
PR Checklist