-
Notifications
You must be signed in to change notification settings - Fork 382
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
Rule Request: UseCompatibleStrings #2015
Comments
I would name it |
Thanks... would want to make sure this came with great test coverage 😄 |
Specifically for the escape character ( $Esc = $([char]0x1b)
"This is $Esc[7mInverse$Esc[27m text." The same might apply to any specific unicode escape sequences (although less common): $Smiley = $([char]0x263a)
"Please $Smiley, I am taking a picture" |
@iRon7 I'm not sure I agree that we should be defining a new variable. There's a minutia of complexities with doing so. Not least of all:
With PowerShell's dynamic scopes, lexical analysis would be insufficient to find a suitable name or place. Though perhaps I'm over-thinking it? 🤔 I've made a first stab at the MVP of this and learned a fair bit. As Sydney says, much testing is going to be needed; There are many edge cases. |
Summary of the new feature
The
`e
and`u{xxxx}
special characters in double-quoted strings were added in Powershell 6. It would be nice to have a compatibility rule that detects these escape characters when writing for Powershell <6 and suggests a different syntax (ex. suggesting$([char]0x1b)
for`e
)What is the latest version of PSScriptAnalyzer at the point of writing
v1.22
The text was updated successfully, but these errors were encountered: