Fix PSSA rule violation in New-CcmDeploymentStep

Open Beginner friendly
#64 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

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.

Description

0 - Backlog Bug Up For Grabs
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

Dominant language
PowerShell
Stars
7
Forks
11
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from chocolatey/ChocoCCM

All issues in chocolatey/ChocoCCM

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.