vscode-powershell icon indicating copy to clipboard operation
vscode-powershell copied to clipboard

Feature Request: Bring Invoke-PSScriptAnalyzer to PowerShell Command Palate

Open ld0614 opened this issue 2 years ago • 1 comments

Prerequisites

  • [X] I have written a descriptive issue title.
  • [X] 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

ld0614 avatar Mar 05 '23 14:03 ld0614

Thanks @ld0614 you could accomplish this today by creating a custom task in VSCode https://code.visualstudio.com/Docs/editor/tasks ...I will mark this as up for grabs

SydneyhSmith avatar Mar 07 '23 19:03 SydneyhSmith