PowerShell / PowerShell/vscode-powershell

Add option to specify paths for ScriptAnalyzer-evaluation

Open
#3,048 10 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Configuration 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

Summary of the new feature

This extension should include a setting to specify which paths to run Script Analysis against. Currently the extension reads the PSScriptAnalyzer.psd1-file in workspace root (if not modified) and executes PSSA against all files recursively.

Let's say you only want to run the rules against src/* and tool/*. AFAIK this can't be configured in the extension nor PSScriptAnalyzer.psd1, which can result in many unnecessary problems and warnings in folders without the same requirements to follow best practices.

Proposed technical implementation details (optional)

Invoke-ScriptAnalyzer solves this problem by requiring a Path or ScriptDefinition parameter. As the extension uses the latter option, then the logic and paths-setting would have to be part of the Script Analysis-part of vscode-powershell + PowerShellEditorServices.

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 tracing the Script Analysis logic in vscode-powershell and PowerShellEditorServices, focusing on how Invoke-ScriptAnalyzer currently receives its ScriptDefinition and how PSScriptAnalyzer.psd1 is read. Define where a paths setting belongs, then verify that paths such as src/* and tool/* limit analysis while unrelated workspace files are excluded.

Written by the indexing model from the issue text.

Assessment

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