Skip to content

Instantly share code, notes, and snippets.

@bielawb

bielawb/FindHelpComment.ps1 Secret

Created Apr 11, 2021
Embed
What would you like to do?
Szukamy komentarzy, które zawierają pomoc z błędami
$keywords = @(
'Synopsis'
'Description'
'Example'
'Inputs'
'Outputs'
'Notes'
'Link'
'Component'
'Role'
'Functionality'
)
foreach ($suspect in $first, $last) {
if ($suspect.Kind -eq 'Comment') {
@([regex]::Matches($suspect.Text, '(?m)^\s*\.(.*)$')).Where{
$_.Groups[1].Value.Trim() -notin $keywords -and
$_.Groups[1].Value -notmatch 'Parameter \w+'
}.ForEach{
'Nieprawidłowa składnia w pomocy: .{0}' -f $_.Groups[1].Value
}
} else {
Write-Verbose -Message "Odnaleziony element nie jest komentarzem: $suspect"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment