Modules/businessdev.ALbuild.Apps/Private/Get-BcAlExecutableLines.ps1
|
function Get-BcAlExecutableLines { <# .SYNOPSIS Returns the executable statement lines of an AL source file -- the honest denominator for code coverage. .DESCRIPTION Business Central's coverage export lists only Covered/PartiallyCovered lines, so the total comes from the source. This returns the lines BC can report: one per statement, on its first line, outside [NonDebuggable] methods and outside non-compiled #if branches. See Get-BcAlSourceModel for the rules. .PARAMETER Path The .al file to analyse. .PARAMETER Symbols The preprocessor symbols the file was compiled with (normally from the app's app.json). Omitted means no #if branch is skipped. .OUTPUTS int[] -- sorted, distinct 1-based source line numbers that carry an executable statement. #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '', Justification = 'Returns a set of executable lines; the plural noun is intentional and clearer.')] [CmdletBinding()] [OutputType([int[]])] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $Path, [string[]] $Symbols = @() ) return @((Get-BcAlSourceModel -Path $Path -Symbols $Symbols).ExecutableLines) } |