PowerShell / PowerShell/PSScriptAnalyzer

Check for platform-dependent path usage

オープン
#1,093 コメント 3 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Area - Rules Issue - Enhancement Issue - New Rule Up-for-Grabs
主要言語
C#
スター
2.2k
フォーク
414
平均マージ
13時間 1分
マージ済み PR(30日)
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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

この issue では、ファイル、テスト、既存のルール エントリ ポイントが指定されていません。まず、PSScriptAnalyzer がルールをどのように実装し、*-Item および *-Path cmdlet とエイリアスをどのように識別しているかを確認してください。実装する前に、サポートするプラットフォーム固有のパターンと constant-folding の範囲を定義してください。完了とは、ルールが合意されたケースを検出し、サポートされている場合は修正でき、テストも備わっていることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, powershell
領域
tooling
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。