Runs, and then summarises the results of PSScriptAnalyzer across a set of PowerShell function files.
Get-MFScriptAnalyzerSummary [[-SourcePath] <String>] [[-Severity] <String[]>] [[-Weights] <Hashtable>]
[-SuppressOutput] [[-ExcludeRules] <String[]>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
This function scans `.ps1` files using PSScriptAnalyzer and returns grouped summaries of errors, warnings, and informational findings.
Get-MFScriptAnalyzerSummary -SourcePath '.\source\functions'
Runs PSScriptAnalyzer over all function files in the specified path, provides a summary
Copy of the output of this line
Source Path for function files
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: $(join-path $(join-path '.' -childPath 'source') -childPath functions)
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
What severities should we scan for
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: @('Error','Warning','Information')
Accept pipeline input: False
Accept wildcard characters: False
What weights to provide each severity
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: @{
Error = 50
Warning = 15
Information = 1
}
Accept pipeline input: False
Accept wildcard characters: False
Set this switch to only get the summary
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Set this for what rules to exclude. Noisy rule. Preference script readability over strict whitespace adherance
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: @(
'PSAvoidTrailingWhitespace' #Noisy rule. Preference script readability over strict whitespace adherance
)
Accept pipeline input: False
Accept wildcard characters: False
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Author: Adrian Andersson