PowerShell / PowerShell/PSScriptAnalyzer
New rule to warn against break/continue outside of loops or traps
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.2k
- Forks
- 414
- Avg merge
- 13h 1m
- Merged PRs (30d)
- 2
Description
From https://github.com/PowerShell/PowerShell/issues/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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No implementation files, tests, or entry points are named. Start by locating existing analyzer rules and their tests, then confirm whether the intended scope covers both break and continue and how loop or trap context is identified. Done means the rule warns for the targeted misuse and tests cover the warning behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100