エディター経由がいいなと思いましたが、Visual Studio Codeのマーケットプレイス見たものの、どうもない様子。
じゃあPowerShellのモジュールでないのかなと思ったら、ありました。という事、今回は備忘録かつShort Tipsです。
PowerShell Script Analyzer: Static Code analysis for Windows PowerShell scripts & modules
https://blogs.msdn.microsoft.com/powershell/2015/02/24/powershell-script-analyzer-static-code-analysis-for-windows-powershell-scripts-modules/
が該当しました。ですが、肝心のダウンロード先が不明確。
改めて調査し直し、githubにPSScriptAnalyzerがありました!
Windows PowerShell 3.0 or greater とあるので、どこでも使い易いのではないでしょうか。
https://github.com/PowerShell/PSScriptAnalyzer#introduction
ダウンロード先のガイドは下記にもあります。
https://www.powershellgallery.com/packages/PSScriptAnalyzer/
Install-Module -Name PSScriptAnalyzerを実行しますが、管理者権限が必要です。

管理者権限で改めてインストールします。

Get-ScriptAnalyzerRule、Invoke-ScriptAnalyzerが使えます~

カスタムルールも作れますが、シンプルに使うなら、
Invoke-ScriptAnalyzer チェックするPowerShellです。
ちなみに、Ignite2016Downloader.ps1を試しにチェックする以下のような感じになりますよ。
※手元にちょうどあったので、Ignite2016Downloader.ps1を確認してみました。自分のファイル有れば良かったのですが、申し訳ないです。

以上、参考になれば幸いです。
0 件のコメント:
コメントを投稿