PowerShell / PowerShell/PSScriptAnalyzer
Check whether a module references itself in 'NestedModules' field in the .psd1 file
まだ誰も着手していません。
- 主要言語
- C#
- スター
- 2.2k
- フォーク
- 414
- 平均マージ
- 13時間 1分
- マージ済み PR(30日)
- 2
説明
This feature ask is per discussion in https://github.com/PowerShell/PowerShell/pull/6843#discussion_r187123774.
Importing a ill-structured module could result in a circular nested module. For example, for the following code, you will see 'True' as the output.
$testdir = Join-Path $env:TEMP test
$testpsm1 = Join-Path $testdir test.psm1
$testpsd1 = Join-Path $testdir test.psd1
mkdir $testdir > $null
Set-Content $testpsm1 -Value "function bar {}"
Set-Content $testpsd1 -Value "@{ ModuleVersion = '0.0.1'; RootModule = 'test'; NestedModules = @('test') }"
$m = Import-Module $testpsd1 -Pass
$m -eq $m.NestedModules[0]
> True
So maybe a rule can be written to check the bold part of test.psd1 "@{ ModuleVersion = '0.0.1'; RootModule = 'test'; NestedModules = @('test') }", to make sure the author is warned when a module like test.psd1 has itself as a nested module.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、示されている .psd1 の内容で循環するネストされたモジュールの例を再現し、PSScriptAnalyzer がモジュールの問題をどのように検出して報告するかを調べます。NestedModules フィールドが自身を参照しているモジュールが警告を生成し、有効なネストされたモジュール宣言には影響がない状態になれば変更は完了です。ペイロードでは実装ファイルやテストを指定していません。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- powershell
- 領域
- devtools
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100