-
Notifications
You must be signed in to change notification settings - Fork 394
Rule Request: Warn Against Special Characters that PowerShell Accepts #1436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This feature request is best suited to PSScriptAnalyzer, which provides the warnings for the PowerShell extension. Just to clarify:
|
There is also this VS-Code extension for interactive linting: https://marketplace.visualstudio.com/items?itemName=nachocab.highlight-dodgy-characters |
And I should also spruik UseBOMForUnicodeEncodedFile |
This rule could, in its warning, link to https://docs.microsoft.com/powershell/scripting/dev-cross-plat/vscode/understanding-file-encoding |
Referencing #1880, there should also be a warning when any of the following unicode characters are used to quote a string: U+201C, U+201D, U+201F, U+2019, U+301D, U+301E, U+301F, U+FF02, U+201A, U+2018, U+201B, U+2758, or U+275C. |
Just scanning for |
Powershell 7 supports the use of Em Dash ( – ) for parameter prefixes, while Windows Powershell doesn't and can cause errors such as
I'm not sure how but in the last month a good dozen Em Dashes were accidentally added to my codebase.
As Em Dashes are almost impossible to notice in a fix width font, I think it should be considered best practice to never use them and put a big error/warning on screen when you come across one.
The text was updated successfully, but these errors were encountered: