Switch parameters should never default to $true in PowerShell as it is cumbersome and counterintuitive to set them to $false when needed.
I suggest renaming the switch to -ContinueOnError instead, so that the ordinary and expected default of $false for a switch parameter behaves as expected. We will then need to invert the value before passing it to CCM.
How Did You Get This To Happen? (Steps to Reproduce)
I opened the file for editing in VS Code with the PowerShell extension enabled.
What You Are Seeing?
This parameter declaration breaks the PSSA rule
PSAvoidDefaultValueSwitchParameter
because the switch defaults to$true
:https://github.com/chocolatey/ChocoCCM/blob/2c92049ff1cbfafe4388cf4bb5105eec3083c808/src/Public/New-CCMDeploymentStep.ps1#L110-L112
What is Expected?
Switch parameters should never default to $true in PowerShell as it is cumbersome and counterintuitive to set them to $false when needed.
I suggest renaming the switch to
-ContinueOnError
instead, so that the ordinary and expected default of$false
for a switch parameter behaves as expected. We will then need to invert the value before passing it to CCM.How Did You Get This To Happen? (Steps to Reproduce)
I opened the file for editing in VS Code with the PowerShell extension enabled.
System Details
N/A
Output Log
N/A