You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I logged this in the PowerShell repo but they advised to log it here too. Not sure if it’s a PowerShell extension bug or the Script Analyszer.
Since the update to the PowerShell Extension 1.8.0 (and 1.8.1) I am seeing 100s of alerts about my scripts in the 'Problems' section of VSCode indicating "[PSScriptAnalyzer] Line has trailing whitespace (PSAvoidTrailingWhitespace)". This rule in the script analzyer seems to be extremely unreliable since it's highlighting many lines of code that do not have any trailing or leading spaces - mainly in code that is tab intended or where text strings span across multiple lines (word wrap enabled).
Also disabling this rule via the command palette, PowerShell: Select PsScriptAnalyzerRules doesn’t seem to stay disabled across restarts. Each time I restart VSCode the option is re-enabled.
Steps to reproduce
Create a .PS1 file in VSCode and enter the following text. The file is a .ps1 using Windows 1252 encoding and CRLF:
No error should be reported for the above code because it does not contain trailing spaces.
Actual behavior
The analyzer indicates that the line with the closing parenthesis has trailing whitespace, but it does not. Specific error:
"[PSScriptAnalyzer] Line has trailing whitespace (PSAvoidTrailingWhitespace)"
The file is a .ps1 using Windows 1252 encoding and CRLF.
Environment data
>$PSVersionTable5.1> (Get-Module-ListAvailable PSScriptAnalyzer).Version |ForEach-Object { $_.ToString() }
I don’t have the module installed. This is an issue editing PowerShell scripts in VSCode with the latest version of the PowerShell extension (1.8.0 and 1.8.1)
The text was updated successfully, but these errors were encountered:
Duplicate of #1033
The rule is new in PSSA 1.17.1 and got enabled by default in the latest update of the vs code extension. The rule should probably not flag whitespace only lines by default. I am thinking the short term solution would be to not enable the rule in the extension by default for the moment, I opened a PR for that below. The problem that the extension does not persist the settings is a known problem with the extension tracked by issue PowerShell/vscode-powershell#823 but one could use PSSA setting files instead to persist the rule set.
Feel free to ask more questions if this was not clear enough as I only described it on a high level.
I logged this in the PowerShell repo but they advised to log it here too. Not sure if it’s a PowerShell extension bug or the Script Analyszer.
Since the update to the PowerShell Extension 1.8.0 (and 1.8.1) I am seeing 100s of alerts about my scripts in the 'Problems' section of VSCode indicating "[PSScriptAnalyzer] Line has trailing whitespace (PSAvoidTrailingWhitespace)". This rule in the script analzyer seems to be extremely unreliable since it's highlighting many lines of code that do not have any trailing or leading spaces - mainly in code that is tab intended or where text strings span across multiple lines (word wrap enabled).
Also disabling this rule via the command palette, PowerShell: Select PsScriptAnalyzerRules doesn’t seem to stay disabled across restarts. Each time I restart VSCode the option is re-enabled.
Steps to reproduce
Create a .PS1 file in VSCode and enter the following text. The file is a .ps1 using Windows 1252 encoding and CRLF:
Expected behavior
Actual behavior
Environment data
The text was updated successfully, but these errors were encountered: