ps/Modules/Alkami.PowerShell.PSScriptAnalyzerRules/Public/Invoke-CustomRuleAnalyzers.ps1

24 lines
652 B
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Invoke-CustomRuleAnalyzers {
<#
.SYNOPSIS
Execute analyzer rules against a specific path.
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$TargetPath,
[Parameter()]
[string]$CustomRulePath,
[switch]$Recurse
)
if($null -eq $CustomRulePath)
{
$root = Split-Path -Path $PSScriptRoot -Parent
Write-Host "root: $root"
$CustomRulePath = Join-Path -Path $root -ChildPath "Alkami.PowerShell.PSScriptAnalyzerRules.psm1"
}
Invoke-ScriptAnalyzer -Path $TargetPath -Recurse:$Recurse -IncludeDefaultRules -CustomRulePath $CustomRulePath
}