PowerShell – Pester and Invoke-ScriptAnalyzer

I have recently been looking for a way to run static code analysis on my PowerShell projects using Pester and Invoke-ScriptAnalyzer. I wanted to be able to check the quality of my code while I ran other tests without having to remember to run Invoke-ScriptAnalyzer.

I put my tests in a separate directory called tests; like in the screenshot below.

The code for running Invoke-ScriptAnalyzer with Pester is below.

The output from the above should look like it does below, if your code passes the static code analysis tests.

The latest copy can be downloaded from my GitHub repository.

About the author

Ben Taylor

Cloud and PowerShell enthusiast with a penchant for automation and CI.

View all posts

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *