Skip to content

Commit

Permalink
Update comment-based help for Test-FunctionHelpCoverage
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuBuisson committed Oct 11, 2017
1 parent a754224 commit edfb605
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions PSCodeHealth/Private/Metrics/Test-FunctionHelpCoverage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Function Test-FunctionHelpCoverage {
.SYNOPSIS
Tells whether or not the specified function definition contains help information.
.DESCRIPTION
Tells whether or not the specified function definition specified as a [System.Management.Automation.Language.FunctionDefinitionAst] contains help information (a CommentHelpInfo object).
Tells whether or not the specified function definition specified as a [System.Management.Automation.Language.FunctionDefinitionAst] contains help information.
This function returns $True if the specified function definition AST has a CommentHelpInfo or if the function name is listed in an external help file.
.PARAMETER FunctionDefinition
To specify the function definition to analyze.
Expand All @@ -27,8 +28,9 @@ Function Test-FunctionHelpCoverage {
)

$FunctionHelpInfo = $FunctionDefinition.GetHelpContent()
$CommentBasedHelpPresent = $FunctionHelpInfo -is [System.Management.Automation.Language.CommentHelpInfo]
$ExternalHelpPresent = $FunctionDefinition.Name -in $Script:ExternalHelpCommandNames
[bool]$CommentBasedHelpPresent = $FunctionHelpInfo -is [System.Management.Automation.Language.CommentHelpInfo]

[bool]$ExternalHelpPresent = $FunctionDefinition.Name -in $Script:ExternalHelpCommandNames
$HelpPresent = $CommentBasedHelpPresent -or $ExternalHelpPresent
return $HelpPresent
}
}

0 comments on commit edfb605

Please sign in to comment.