Skip to content
Andrew Davidson edited this page Dec 27, 2020 · 17 revisions

PSQualityCheck

Summary

This is a PowerShell module which runs a series of Pester 5 tests to validate code quality against it's rules

Standards

The standards that these scripts are enforcing are detailed here: Standards

Rules

The rules that are tested are detailed here: Module Tests and here: Script Tests

Basic usage

Check the folder C:\Scripts:

Invoke-PSQualityCheck -Path 'C:\Scripts'

Check the folders C:\Scripts and C:\MoreScripts':

Invoke-PSQualityCheck -Path @('C:\Scripts', 'C:\MoreScripts')

Check the file C:\Scripts\Script.ps1:

Invoke-PSQualityCheck -File 'C:\Scripts\Script.ps1'

Check the file C:\Scripts\Script.ps1 with the extra PSScriptAnalyzer rules used by SonarQube:

Invoke-PSQualityCheck -File 'C:\Scripts\Script.ps1' -SonarQubeRulesPath 'C:\SonarQubeRules'

This will display a summary of the checks performed (example below uses sample data):

Invoke-PSQualityCheck -Path 'C:\Scripts' -ShowCheckResults

Name                            Files Tested Total Passed Failed Skipped
----                            ------------ ----- ------ ------ -------
Module Tests                               2    14     14      0       0
Extracting functions                       2     2      2      0       0
Extracted function script tests           22   330    309      0      21
Total                                     24   346    325      0      21

Future Plans

The plan for the future of the module is detailed here: Future Plans

Clone this wiki locally