PowerShell / PowerShell/PSScriptAnalyzer
PSAvoidUsingCmdletAliases triggers on GherkinStep
オープン
まだ誰も着手していません。
Area - Rules
Issue - Enhancement
Up-for-Grabs
- 主要言語
- C#
- スター
- 2.2k
- フォーク
- 414
- 平均マージ
- 13時間 1分
- マージ済み PR(30日)
- 2
説明
Gherkin (including in Pester) has a few aliases which you are meant to use when creating steps.
Alias And -> GherkinStep 4.2.0 Pester
Alias But -> GherkinStep 4.2.0 Pester
Alias Given -> GherkinStep 4.2.0 Pester
Alias Then -> GherkinStep 4.2.0 Pester
Alias When -> GherkinStep 4.2.0 Pester
These are valid uses of the alias and shouldn't trigger analyzer warnings.
Steps to reproduce
Create a Gherkin (Pester) step file like Blah.Steps.ps1
Given "something" {
}
Then Invoke-ScriptAnalyzer Blah.Steps.ps1
Expected behavior
No issues.
Actual behavior
RuleName Severity ScriptName Line Message
-------- -------- ---------- ---- -------
PSAvoidUsingCmdletAliases Warning Blah.Steps 1 'Given' is an alias of 'GherkinStep'. Alias can introduce
.ps1 possible problems and make scripts hard to maintain. Please
consider changing alias to its full content.
Environment data
Name Value
---- -----
PSVersion 5.1.14393.1944
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.1944
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
1.16.1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Invoke-ScriptAnalyzer を実行し、PSAvoidUsingCmdletAliases と GherkinStep エイリアスに焦点を当てて、Blah.Steps.ps1 の例で警告を再現します。完了の定義は、Pester Gherkin ステップとして使用される Given、And、But、When、Then では analyzer の問題が生成されず、通常のエイリアスは引き続きルールの対象となることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp, powershell
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100