Skip to content

Instantly share code, notes, and snippets.

@bielawb
Created April 11, 2021 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bielawb/34872d13b3d2f5cafe34621e52f29f53 to your computer and use it in GitHub Desktop.
Save bielawb/34872d13b3d2f5cafe34621e52f29f53 to your computer and use it in GitHub Desktop.
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