PowerShell / PSScriptAnalyzer

Download ScriptAnalyzer from PowerShellGallery
https://www.powershellgallery.com/packages/PSScriptAnalyzer/
MIT License
1.86k stars 377 forks source link

Hint: How to have a good Scriptpool to parse and test against #921

Closed Kriegel closed 6 years ago

Kriegel commented 6 years ago

Hi!

One of my Test is to run ScriptAnalyzer with my custom rule against a large amount of scripts out of the wild Internet.

To have scripts that contains all PowerShell technics like Workflows, Classes, DSC, CIM, COM, and other weired stuff, i grabbed the teaching scripts from Powershell Teaching Books.

(But be aware of that even these Scripts have Typos you have to fix at first runs !!!!!!!!)

You can grab the Sample Files from Manning from Books of Bruce Payette, Don Jones, Jeffrey Hicks and others. https://www.manning.com/

You can grab even the sample files from the PowerShell Cookbook from Lee Holmes https://github.com/LeeHolmes/PowerShellCookbook

(i pulled scripts from Books from MVPs Tobias Weltner and Holger Schwichtenberg too)

You can pull Scripts and Modules even from the PowerShell Gallery or from the "Microsoft Script Center"

https://www.powershellgallery.com/ https://gallery.technet.microsoft.com/scriptcenter

I put all these Scripts in one directory. So I have nearly 2000 Scripts and Modules to run against with a fingersnap covering nearly all PowerShell technics.

And then i run PSScriptAnalyzer against these Scripts with my custom rule.

Hope this hint was useful and not time wasting. cheers Peter

bergmeister commented 6 years ago

Thanks for the good will of providing helpful links. This is something worth considering at some point but to be honest we have to tackle the known issues first. PSScriptAnalyzer is using the parser classes of PowerShell itself for parsing and analysing the scripts and from then on is just working on the AST. Currently we are even in the process of requesting a missing feature in the parser. Therefore we would mostly be testing the parser code, which is not really part of this repo. A good test of PSSA is running it against the PowerShell Core repo and I am already aware of some issues here.