PowerShell / PowerShell/vscode-powershell

Feature Request: Bring Invoke-PSScriptAnalyzer to PowerShell Command Palate

Open
#4,444 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Script Analysis Issue-Enhancement Up for Grabs
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
Summary

For day to day/line by line development the default PSScriptAnalyzer rules in VS Code work well and ensure that it doesn't slow down my development too much. There are however times when I would like to do a more thorough review of the code, for example before publishing remotely or presenting the code to others.

In this scenario, I would like to be able to easily run the full range of tests that PSScriptAnalyzer has without resorting to:

  • Modifying the everyday ruleset
  • Calling the command line directly

For me (and I suspect others) this would enhance discoverability of this great tool, speed up ad-hoc usage and therefore encourage a much greater usage of the non-realtime rulesets

Proposed Design

When I first attempted to do this I instinctively looked for an option in the PowerShell command list, in the same place as 'Run' and 'Run Pester Tests'
image

To cater for multiple rulesets my thought process would be to offer the following command structure:

  • PowerShell: Run PSScriptAnalyzer
    • Default RuleSet (Same as Invoke-PSScriptAnalyser Default RuleSet)
    • All Rules (All code and formatting rules)
    • Realtime Rules (The ruleset currently configured for real-time analysis)
    • Custom (Specify a PSScriptAnalyzer ruleset file)
      • Select Location

Brackets/Names are for explanation purposes rather than anticipated naming

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 locating the existing VS Code command implementations for Run and Run Pester Tests, then trace how commands access the active script and configured PSScriptAnalyzer rules. Done means the command palette exposes default, all, realtime, and custom ruleset options, including custom ruleset location selection.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, vscode
Domain
developer-experience, 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.