Script Analyzer

Script Analyzer

Checks for well-known mistakes

Rules are a community effort

Invoke-ScriptAnalyzer -Path .\ConvertTo-Base64.ps1

Findings can be suppressed:

function ConvertTo-Base64 {
    Justification="Just an example"

Test Driven Design

Unit tests in PowerShell with Pester

Import-Module Base64
Describe 'ConvertTo-Base64` {
  It 'Accepts parameter' {
    { ConvertFrom 'BlargBlubb' } | Should Not Throw

Place in separate files (*.Tests.ps1)

Place in separate filder (\Tests)

Also supports code coverage

Comment Based Help

Comment inside function body

function ConvertTo-Base64 {
  Converts strings to Base64
  .PARAMETER InputObject
  One or more strings
  .PARAMETER Encoding
  Encoding to use for conversion (default: UTF8)


Automatically available through -? and Get-Help

Also works for scripts

Markdown Based Help

Write your help files in markdown with platyPS

Generate markdown help for existing functions:

New-MarkdownHelp -Module MyAwesomeModule -OutputFolder .\docs

Generate PowerShell help files from markdown:

New-ExternalHelp .\docs -OutputPath en-US\

Add another step to your pipeline