Skip to content

PSUseCmdletCorrectly fails to detect when mandatory parameters are supplied in a splatted hashtable #202

Closed
@KirkMunro

Description

@KirkMunro

Today it seems that PSUseCmdletCorrectly fails to detect when mandatory parameters are supplied to a cmdlet via a splatted hashtable.

Since determining the contents of the hashtable is a runtime activity (and looking at my script it would be difficult if not impossible to do so without running it), I would prefer if this warning wouldn't be generated at all when splatting. Knowing how I use splatting, it is often because building the required parameter set is complicated, in which case this warning shouldn't appear at all.

But, isn't this yet another case where PSScriptAnalyzer is overstepping its bounds? Checking to see if mandatory parameters are used, unless it is obvious (with pipeline support - I noticed there is another bug logged about that) should be something that happens from unit testing, not from analysis IMHO. These types of errors are very easy to understand when they do occur, they tend to occur quickly and be identified through simple testing, and this rule is just generating noise for me right now.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions