Skip to content

Instantly share code, notes, and snippets.

@Stuart-Moore
Created December 6, 2016 18:50
Show Gist options
  • Save Stuart-Moore/49bb13369be569ff0990fdfd7f2e89fc to your computer and use it in GitHub Desktop.
Save Stuart-Moore/49bb13369be569ff0990fdfd7f2e89fc to your computer and use it in GitHub Desktop.
$externals = Get-ChildItem "$ModulePath\functions\"
$Rules = (Get-ScriptAnalyzerRule).Where{$_.RuleName -notin ('PSAvoidUsingPlainTextForPassword') }
Describe -tags ('ScriptAnalysis')'Script Analyzer Tests' {
ForEach ($ScriptFile in $externals)
{
Context "Testing $ScriptFile for Standard Processing" {
foreach ($rule in $rules)
{
$i = $rules.IndexOf($rule)
It "$ScriptFile passes the PSScriptAnalyzer Rule number $i - $rule " {
(Invoke-ScriptAnalyzer -Path "$($ScriptFile.fullname)" -IncludeRule $rule.RuleName ).Count | Should Be 0
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment