Summary
$Rules in New-FeatureFlag is declared [Parameter(Mandatory)] and simultaneously initialized to $Rules = @(). PSScriptAnalyzer flags this as PSAvoidDefaultValueForMandatoryParameter. A Mandatory parameter with a default value is a contradiction — PowerShell ignores the default and prompts for input.
Since feature flags are commonly created with no rules initially (rules are added later), Mandatory is almost certainly wrong here.
File
Gatekeeper/Public/New-FeatureFlag.ps1:58-60
Fix
Remove Mandatory from the parameter declaration:
# Before
[Parameter(Mandatory, ValueFromPipeline)]
[Rule[]]
$Rules = @(),
# After
[Parameter(ValueFromPipeline)]
[Rule[]]
$Rules = @(),
Notes
- Good first issue
- Found by Brent Tlackburn
Summary
$RulesinNew-FeatureFlagis declared[Parameter(Mandatory)]and simultaneously initialized to$Rules = @(). PSScriptAnalyzer flags this asPSAvoidDefaultValueForMandatoryParameter. AMandatoryparameter with a default value is a contradiction — PowerShell ignores the default and prompts for input.Since feature flags are commonly created with no rules initially (rules are added later),
Mandatoryis almost certainly wrong here.File
Gatekeeper/Public/New-FeatureFlag.ps1:58-60Fix
Remove
Mandatoryfrom the parameter declaration:Notes