PowerShell / PowerShell/PSScriptAnalyzer
Every time we analyze a '.ps1' file with custom rules, we need to import module once again.
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.2k
- Forks
- 414
- Avg merge
- 13h 1m
- Merged PRs (30d)
- 2
Description
Hi! We are using PSSA to analyze syntax errors in '.ps1' files with custom rules. It seems that a new PowerShell session is created when we invoke-ScriptAnalyzer with custom rules, then all the modules imported before are lost. So, every time we analyze a '.ps1' file with custom rules, we need to import the needed module once again. However, it is time costly for us to import modules again and again. Since we work in the continuous integration environment, we need to import the modules built by CI but not the modules installed locally. 'Import-module' ahead of the '.psm1' file of custom rules seems indispensable. Can you give some suggestions to solve the problem of import modules too many times when analyzing dozens of '.ps1' files? Thanks a lot!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Invoke-ScriptAnalyzer entry point and trace how custom-rule .psm1 files and PowerShell sessions are handled. Reproduce analysis of several .ps1 files with CI-built modules, then determine whether the session can be reused without loading locally installed modules. Done means custom rules can use the intended imported modules without importing them for every file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100