chocolatey / chocolatey/ChocoCCM

Fix PSSA rule violation in New-CcmDeploymentStep

Open Beginner friendly
#64 0 comments 0 reactions 0 assignees View on GitHub
0 - Backlog Bug Up For Grabs
Dominant language
PowerShell
Stars
7
Forks
11
PR merge metrics
No merged PRs in 30d

Description

### 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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/Public/New-CCMDeploymentStep.ps1 at the parameter declaration around lines 110-112, then inspect how that parameter is passed to CCM. Rename the switch as proposed and verify the default behavior and PSSA compliance, including any relevant module tests if present.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.