PowerShell / PowerShell/PSScriptAnalyzer
New rule to warn against break/continue outside of loops or traps
未关闭
还没有人认领这个 Issue。
Area - Rules
Issue - New Rule
Up-for-Grabs
- 主要语言
- C#
- 星标
- 2.2k
- 派生
- 414
- 平均合并
- 13 小时 1 分钟
- 30 天内合并 PR
- 2
描述
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
未指定实现文件、测试或入口点。首先定位现有的分析器规则及其测试,然后确认预期范围是否同时涵盖 break 和 continue,以及如何识别循环或 trap 上下文。当该规则会针对目标误用发出警告,且测试覆盖警告行为时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp, powershell
- 领域
- tooling
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100