Skip to content

Commit 33ae40f

Browse files
committed
Add markdown file fix and test library mock for new -ReportSummary switch
1 parent a8dbb1f commit 33ae40f

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

Tests/Engine/LibraryUsage.tests.ps1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ function Invoke-ScriptAnalyzer {
5454
[switch] $Fix,
5555

5656
[Parameter(Mandatory = $false)]
57-
[switch] $EnableExit
57+
[switch] $EnableExit,
58+
59+
[Parameter(Mandatory = $false)]
60+
[switch] $ReportSummary
5861
)
5962

6063
if ($null -eq $CustomRulePath)
@@ -98,6 +101,11 @@ function Invoke-ScriptAnalyzer {
98101
}
99102

100103
$results
104+
105+
if ($ReportSummary.IsPresent -and $null -ne $results)
106+
{
107+
Write-Host "Found $results.Count warnings" # This is not the exact message that it would print but close enough
108+
}
101109

102110
if ($EnableExit.IsPresent -and $null -ne $results)
103111
{

docs/markdown/Invoke-ScriptAnalyzer.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ Evaluates a script or module based on selected best practice rules
1212
### UNNAMED_PARAMETER_SET_1
1313
```
1414
Invoke-ScriptAnalyzer [-Path] <String> [-CustomRulePath <String>] [-RecurseCustomRulePath]
15-
[-ExcludeRule <String[]>] [-IncludeRule <String[]>] [-Severity <String[]>] [-Recurse] [-SuppressedOnly] [-Fix] [-EnableExit]
15+
[-ExcludeRule <String[]>] [-IncludeRule <String[]>] [-Severity <String[]>] [-Recurse] [-SuppressedOnly] [-Fix] [-EnableExit] [-ReportSummary]
1616
[-Settings <String>]
1717
```
1818

1919
### UNNAMED_PARAMETER_SET_2
2020
```
2121
Invoke-ScriptAnalyzer [-ScriptDefinition] <String> [-CustomRulePath <String>] [-RecurseCustomRulePath]
22-
[-ExcludeRule <String[]>] [-IncludeRule <String[]>] [-Severity <String[]>] [-Recurse] [-SuppressedOnly] [-EnableExit]
22+
[-ExcludeRule <String[]>] [-IncludeRule <String[]>] [-Severity <String[]>] [-Recurse] [-SuppressedOnly] [-EnableExit] [-ReportSummary]
2323
[-Settings <String>]
2424
```
2525

@@ -432,6 +432,21 @@ Accept pipeline input: False
432432
Accept wildcard characters: False
433433
```
434434
435+
### -ReportSummary
436+
Writes a report summary of the found warnings to the host.
437+
438+
```yaml
439+
Type: SwitchParameter
440+
Parameter Sets: (All)
441+
Aliases:
442+
443+
Required: False
444+
Position: Named
445+
Default value: False
446+
Accept pipeline input: False
447+
Accept wildcard characters: False
448+
```
449+
435450
### -Settings
436451
File path that contains user profile or hash table for ScriptAnalyzer
437452

0 commit comments

Comments
 (0)