2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

pre-commit: add summary check by Markus (Forum #39854)

git-svn-id: https://svn.fhem.de/fhem/trunk@12018 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-08-20 16:25:11 +00:00
parent 0a8d9b2fef
commit 304bed7ec9

View File

@ -88,12 +88,20 @@ foreach my $row (split("\n", $fList)) {
my $line = 0;
my $docCount = 0;
my $hasLink = 0;
my $hasSummary = 0;
while(my $l = <MOD>) {
$line++;
err $fName, "DOS line encoding is not supported."
if($l =~ m/^=begin html$suffix.*\r/);
if($l =~ m/^=item summary$suffix\s+(.+?)\s*$/) {
err $fName, "$lang: summary is longer than 80 chars on line $line"
if(length($1) > 80);
$hasSummary = 1;
}
if($l =~ m/^=begin html$suffix$/) {
$l = <MOD>; # skip one line, to be able to repeat join+split
err($fName, "$lang: nonempty line after =begin html.")
@ -120,6 +128,9 @@ foreach my $row (split("\n", $fList)) {
if(!$suffix && !$docCount);
err $fName, "$lang: No <a name=\"$modName\"> link"
if(!$suffix && $docCount && !$hasLink);
err $fName, "$lang: No summary description found"
if(!$suffix && $docCount && !$hasSummary);
foreach $tag (TAGS) {
err $fName, "$lang: Unbalanced $tag ($tagcount{$tag}, last line ok: $llwct{$tag})"
if($tagcount{$tag});