PowerShell / PowerShell/PSScriptAnalyzer
Check for platform-dependent path usage
还没有人认领这个 Issue。
- 主要语言
- C#
- 星标
- 2.2k
- 派生
- 414
- 平均合并
- 13 小时 1 分钟
- 30 天内合并 PR
- 2
描述
As suggested by @SteveL-MSFT.
A rule that checks/corrects filesystem path usage that doesn't translate across between Windows and UNIX-like OSes could ease migration to PowerShell Core.
User story
As a PowerShell user, I want a rule to tell me when a path I've used
will break my script on another platform, so that I can write
cross-platform scripts more easily (e.g. for Azure scenarios).
Proposed technical implementation
Check all *-*Item and *-Path cmdlets (and their aliases) for direct string/bareword arguments to check for platform specific usages (like C:), or even encourage usage of Join-Path or [System.IO.Path]::Combine() instead of / and \.
Of course this check isn't universally feasible, but this is another case where some constant folding would come in handy for PowerShell analysis (something PSES could also use).
Latest current version of PSSA
1.17.1
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
该 issue 未指定文件、测试或现有的规则入口点。首先查看 PSScriptAnalyzer 如何实现规则,以及它如何识别 *-Item 和 *-Path cmdlet 及别名。在实现之前,先定义受支持的平台特定模式和常量折叠范围;完成的标准是该规则能够检测约定的案例,并在支持的情况下通过测试进行修正。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp, powershell
- 领域
- tooling
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100