Skip to content
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

Proposal: Signal invalid syntax in switch statement condition #1977

Open
SetTrend opened this issue Mar 4, 2024 · 2 comments
Open

Proposal: Signal invalid syntax in switch statement condition #1977

SetTrend opened this issue Mar 4, 2024 · 2 comments

Comments

@SetTrend
Copy link

SetTrend commented Mar 4, 2024

The switch statement condition syntax seems obscure from time to time. See PowerShell issues 21299 and 10911.

Hence, I suggest do add a few checks to test switch statement conditions for invalid syntax. (I.e., syntax that will never be evaluated, or that will always evaluate to $false etc.)

@SydneyhSmith
Copy link
Collaborator

Thanks @SetTrend would love to see more commentary on how someone would think about constructing this rule/what conditions they would consider before moving to up for grabs

@bergmeister
Copy link
Collaborator

Happy to add a rule but we need something concrete that we can alert on based on just static analysis without false positives. But I fear if the parser cannot do that due to PowerShell's dynamic nature, I am not sure PSSA can do better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants