PowerShell / PowerShell/PSScriptAnalyzer
psdscuseidenticalmandatoryparametersfordsc errors
未关闭
还没有人认领这个 Issue。
Area - Rules
Issue - Bug
- 主要语言
- C#
- 星标
- 2.2k
- 派生
- 414
- 平均合并
- 13 小时 1 分钟
- 30 天内合并 PR
- 2
描述
GET/SET/Test have identical parameters.
param
(
[Parameter(Mandatory=$true)]
[System.String]
$DistinguishedName,
[Parameter(Mandatory=$true)]
[Microsoft.Management.Infrastructure.CimInstance[]]
$AccessControlList,
[Parameter(Mandatory=$false)]
[bool]
$Force = $false
)
I get this error when the rule runs.
Invoke-ScriptAnalyzer : Object reference not set to an instance of an object.
At line:1 char:1
- Invoke-ScriptAnalyzer .\AccessControlDsc -Recurse -ExcludeRule 'PSUse ...
-
+ CategoryInfo : InvalidOperation: (<filepath>:String) [Invoke-ScriptAnalyzer], NullReferenceException + FullyQualifiedErrorId : RULE_ERROR,Microsoft.Windows.PowerShell.ScriptAnalyzer.Commands.InvokeScriptAnalyzerCommand
If I exclude this rule then I get no errors.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用所示的 GET/SET/Test 参数,在 AccessControlDsc 路径上通过 Invoke-ScriptAnalyzer 和命令中指定的 PSUse... 规则重现该错误。跟踪该规则对相同必需参数的处理方式;当分析能够在不出现 NullReferenceException 的情况下完成,并改为报告预期结果时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- powershell
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100