-
Notifications
You must be signed in to change notification settings - Fork 407
Closed
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/tree/2726fcde4bba996dcd446b240c3439a129ddba7d/packages
Invoke-ScriptAnalyzer . -Recurse -IncludeRule PSAvoidTrailingWhitespace -FixExpected behavior
I had expected this command to fix the offenses of the PSAvoidTrailingWhitespace rule.
Actual behavior
It removes } causing a MissingEndCurlyBrace parsing error, as you can see in the git diff:

An <U+FEFF> is also added at the beginning of the modified files. This seems related to #1743
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.14409.1005
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1005
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.20.0