Skip to content

Commit 56d4d3a

Browse files
Fix lint findings for missed-path report
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent c89cae0 commit 56d4d3a

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

.github/actions/Get-PesterCodeCoverage/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ This GitHub Action is a part of the [PSModule framework](https://github.com/PSMo
99
## Features
1010

1111
- Combines multiple code coverage reports from parallel test runs
12-
- Generates markdown/HTML tables showing missed & executed commands
12+
- Generates Markdown/HTML tables showing missed & executed commands
1313
- Displays analyzed files and coverage statistics
14-
- Generates a generic missed-path report (markdown + json)
14+
- Generates a generic missed-path report (Markdown + JSON)
1515
- Configurable step summary sections
1616
- Threshold enforcement for minimum code coverage
1717

.github/actions/Get-PesterCodeCoverage/src/main.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,13 @@ $missedPaths = $codeCoverage.CommandsMissed |
171171
ForEach-Object { [int]$_.Line } |
172172
Sort-Object -Unique
173173
[pscustomobject]@{
174-
Path = $_.Name
174+
Path = $_.Name
175175
MissedCommands = [int]$_.Count
176-
MissedLines = if ($lines.Count -eq 0) { '' } else { ($lines -join ', ') }
176+
MissedLines = if ($lines.Count -eq 0) {
177+
''
178+
} else {
179+
$lines -join ', '
180+
}
177181
}
178182
}
179183

@@ -196,7 +200,12 @@ $null = $missedPathMarkdown.Add('# Code Coverage Missed Paths')
196200
$null = $missedPathMarkdown.Add('')
197201
$null = $missedPathMarkdown.Add("| Coverage | Target | Missed Paths | Missed Commands |")
198202
$null = $missedPathMarkdown.Add("| --- | --- | --- | --- |")
199-
$null = $missedPathMarkdown.Add("| $([Math]::Round($coveragePercent, 2))% | $([Math]::Round($coveragePercentTarget, 2))% | $($missedPaths.Count) | $($codeCoverage.CommandsMissedCount) |")
203+
$coverageSummaryRow = '| {0}% | {1}% | {2} | {3} |' -f (
204+
[Math]::Round($coveragePercent, 2)
205+
), (
206+
[Math]::Round($coveragePercentTarget, 2)
207+
), $missedPaths.Count, $codeCoverage.CommandsMissedCount
208+
$null = $missedPathMarkdown.Add($coverageSummaryRow)
200209
$null = $missedPathMarkdown.Add('')
201210
$null = $missedPathMarkdown.Add('## Paths')
202211
$null = $missedPathMarkdown.Add('| Path | Missed Commands | Missed Lines |')

0 commit comments

Comments
 (0)