Created
December 6, 2016 18:50
-
-
Save Stuart-Moore/49bb13369be569ff0990fdfd7f2e89fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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