PowerShell / PowerShell/PSScriptAnalyzer

`invoke-scriptanalyzer -fix -Confirm` should be more specific

Open
#1,854 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area - Engine Issue-Enhancement
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

Currently the -Fix -Confirm (and -WhatIf) common parameters aren't very specific on what and how PSScriptAnalyzer is about to correct the found violations:

invoke-scriptanalyzer .\Test.ps1 -fix -Confirm

Confirm
Are you sure you want to perform this action?
Performing the operation "Analyzing and fixing file C:\Users\Gebruiker\Scripts\Test\Rule\Test.ps1" on target "C:\Users\Gebruiker\Scripts\Test\Rule\Test.ps1".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): n

I would expect a more specific message of what and how a violation is changed, e.g.:

invoke-scriptanalyzer .\Test.ps1 -fix -Confirm

Confirm
Are you sure you want to perform this action?
Changing "$pascalCase = 'Test'" to "$PascalCase = 'Test'" at line 10 character 5 of file  "Analyzing and fixing file C:\Users\Gebruiker\Scripts\Test\Rule\Test.ps1" on target "C:\Users\Gebruiker\Scripts\Test\Rule\Test.ps1".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): n

Contributor guide

Open the contributing guide

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.

Research direction

Start by reproducing the invoke-scriptanalyzer command with -Fix and -Confirm, then locate the implementation of its confirmation handling. No file or test is named; done means the prompt identifies the specific violation change and its location, with coverage for the updated confirmation behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.