★ wanayoo — archive 1999 https://github.com/PowerShell/PSScriptAnalyzer/issues/1507Nouvelle recherche | Portail wanayoo
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

New rule to warn against break/continue outside of loops or traps #1507

Open
rjmholt opened this issue May 21, 2020 · 0 comments
Open

New rule to warn against break/continue outside of loops or traps #1507

rjmholt opened this issue May 21, 2020 · 0 comments

Comments

@rjmholt
Copy link
Member

@rjmholt rjmholt commented May 21, 2020

From PowerShell/PowerShell#12742.

Today break will take control out of a function and up to the first loop in the callstack, possibly exiting the whole script.

Some existing code depends on this, but it's not a good behaviour.

Ideally a rule should warn about this, since using it break outside a loop or trap is usually a mistake that could seriously affect the program.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.