PowerShell / PowerShell/vscode-powershell

Request: Abstract ScriptAnalysis to allow multiple providers

Open
#5,410 12 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Script Analysis Issue-Discussion Issue-Enhancement Verified
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

Howdy howdy!

About six years ago I branched PSSA to experiment with how we might rewrite it to address some of the issues it represents especially for embedding in PSES.

I picked that back up again recently and have spent some time pushing it into an interesting state. I've put it together here.

I pulled in all of PSSA's tests and it passes all of them (except for deliberate breaks, which are either minor or internal type things) when run through its compatibility module.

Anyway, I suspect I won't be maintaining it, but I'd be happy to give it away if it's useful. It's specifically intended to serve PSES scenarios alongside also offering a PS module — it even has a server mode in case you want to run it as a daemon. And maybe this is of interest to @bergmeister too. Oh it also has a few extra rules, including native implementations of InjectionHunter.

Otherwise I just stopped in to say hi and hope all's well!

Proposed Design

If memory serves, we abstracted PSSA in PSES by wrapping it in an analysis service. We could probably do something similar in PSES pretty easily, but this time compiling directly against the DLL because it's meant to be used as a DLL. Also the service could spawn a new process that lives between calls or something — not quite sure about the details there, but the point is to amortise initialisation costs (maybe that scenario is actually better for CI or repeated command line use). Basically it shouldn't be too crazy to integrate if you're interested. And it should be pretty quick for diagnostics and much much faster for formatting

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 reviewing PSES's existing analysis-service wrapper, the proposed Specter project, and its PSSA compatibility tests. Clarify the provider boundary and integration approach before implementing anything; done should mean PSES can support multiple ScriptAnalysis providers while preserving the described diagnostics and formatting use cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.