mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
contrib/pre-commit: new perl version with doc checking
git-svn-id: https://svn.fhem.de/fhem/trunk@6868 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c40063fee2
commit
4af0529bf7
@ -1736,7 +1736,7 @@ LUXTRONIK2_doStatisticDeltaSingle ($$$$$$$)
|
||||
|
||||
<a name="LUXTRONIK2"></a>
|
||||
<h3>LUXTRONIK2</h3>
|
||||
<ul style="width:800px">
|
||||
<ul>
|
||||
Luxtronik 2.0 is a heating controller used in <a href="http://www.alpha-innotec.de">Alpha Innotec</a>, Siemens Novelan (WPR NET) and Wolf Heiztechnik (BWL/BWS) heat pumps.
|
||||
<br>
|
||||
It has a built-in ethernet port, so it can be directly integrated into a local area network (LAN).
|
||||
@ -1854,7 +1854,7 @@ LUXTRONIK2_doStatisticDeltaSingle ($$$$$$$)
|
||||
|
||||
<a name="LUXTRONIK2"></a>
|
||||
<h3>LUXTRONIK2</h3>
|
||||
<ul style="width:800px">
|
||||
<ul>
|
||||
Die Luxtronik 2.0 ist eine Heizungssteuerung, welche in Wärmepumpen von <a href="http://www.alpha-innotec.de">Alpha Innotec</a>,
|
||||
Siemens Novelan (WPR NET) und Wolf Heiztechnik (BWL/BWS) verbaut ist.
|
||||
Sie besitzt einen Ethernet Anschluss, so dass sie direkt in lokale Netzwerke (LAN) integriert werden kann.
|
||||
|
@ -470,7 +470,7 @@ WMBUS_Attr(@)
|
||||
<li><code>is_encrypted</code> is 1 if the received message is encrypted.</li>
|
||||
<li><code>decryption_ok</code> is 1 if a message has either been successfully decrypted or if it is unencrypted.</li>
|
||||
<li><code>state</code> contains the state of the meter and may contain error message like battery low. Normally it contains 'no error'.</li>
|
||||
<li><code>battery</code> contains ok or low.
|
||||
<li><code>battery</code> contains ok or low.</li>
|
||||
</ul>
|
||||
For some well known devices specific readings like the energy consumption in kWh created.
|
||||
</ul>
|
||||
@ -577,7 +577,7 @@ WMBUS_Attr(@)
|
||||
<li><code>is_encrypted</code> ist 1 wenn die empfangene Nachricht verschlüsselt ist.</li>
|
||||
<li><code>decryption_ok</code> ist 1 wenn die Nachricht entweder erfolgreich entschlüsselt wurde oder gar nicht verschlüsselt war.</li>
|
||||
<li><code>state</code> enthält den Status des Zählers und kann Fehlermeldungen wie 'battery low' enthalten. Normalerweise ist der Wert 'no error'.</li>
|
||||
<li><code>battery</code> enthält ok oder low.
|
||||
<li><code>battery</code> enthält ok oder low.</li>
|
||||
</ul>
|
||||
Für einige bekannte Gerätetypen werden zusätzliche Readings wie der Energieverbrauch in kWh erzeugt.
|
||||
</ul>
|
||||
|
@ -906,7 +906,7 @@ JSONMETER_doStatisticDeltaSingle ($$$$$$)
|
||||
|
||||
<a name="JSONMETER"></a>
|
||||
<h3>JSONMETER</h3>
|
||||
<ul style="width:800px">
|
||||
<ul>
|
||||
This module reads data from a measurement unit (so called smart meters for electricity, gas or heat)
|
||||
<br>
|
||||
that provides OBIS compliant data in JSON format on a webserver or on the FHEM file system.
|
||||
@ -1030,7 +1030,7 @@ JSONMETER_doStatisticDeltaSingle ($$$$$$)
|
||||
|
||||
<a name="JSONMETER"></a>
|
||||
<h3>JSONMETER</h3>
|
||||
<ul style="width:800px">
|
||||
<ul>
|
||||
Dieses Modul liest Daten von Messgeräten (z.B. Stromzähler, Gaszähler oder Wärmezähler, so genannte Smartmeter),
|
||||
welche <a href="http://de.wikipedia.org/wiki/OBIS-Kennzahlen">OBIS</a> kompatible Daten im JSON-Format auf einem Webserver oder auf dem FHEM-Dateisystem zur Verfügung stellen.
|
||||
<br>
|
||||
|
@ -1019,7 +1019,7 @@ statistics_UpdateDevReading($$$$)
|
||||
|
||||
<a name="statistics"></a>
|
||||
<h3>statistics</h3>
|
||||
<ul style="width:800px">
|
||||
<ul>
|
||||
This modul calculates for certain readings of given devices statistical values and adds them to the devices.
|
||||
<br>
|
||||
Until now statistics for the following readings are automatically built:
|
||||
@ -1137,7 +1137,7 @@ statistics_UpdateDevReading($$$$)
|
||||
|
||||
<a name="statistics"></a>
|
||||
<h3>statistics</h3>
|
||||
<ul style="width:800px">
|
||||
<ul>
|
||||
Dieses Modul wertet von den angegebenen Geräten (als regulärer Ausdruck) bestimmte Werte statistisch aus und fügt das Ergebnis den jeweiligen Geräten als neue Werte hinzu.
|
||||
<br>
|
||||
<br>
|
||||
@ -1257,4 +1257,4 @@ statistics_UpdateDevReading($$$$)
|
||||
|
||||
=end html_DE
|
||||
|
||||
=cut
|
||||
=cut
|
||||
|
@ -91,11 +91,9 @@ foreach my $lang (@lang) {
|
||||
$docCount++;
|
||||
$hasLink = ($l =~ m/<a name="$mod"/) if(!$hasLink);
|
||||
foreach $tag (TAGS) {
|
||||
my $ot = ($tagcount{$tag} ? $tagcount{$tag} : 0);
|
||||
$tagcount{$tag} +=()= ($l =~ /<$tag>/gi);
|
||||
$tagcount{$tag} -=()= ($l =~ /<\/$tag>/gi);
|
||||
$llwct{$tag} = $line if(!$llwct{$tag} || ($ot && !$tagcount{$tag}));
|
||||
#print "$mod $line $tag $tagcount{$tag}\n" if($tagcount{$tag} ne $ot);
|
||||
$llwct{$tag} = $line if(!$tagcount{$tag});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
94
fhem/contrib/pre-commit
Executable file
94
fhem/contrib/pre-commit
Executable file
@ -0,0 +1,94 @@
|
||||
#!/usr/bin/perl
|
||||
# $Id: commandref_join.pl 5361 2014-03-29 06:24:20Z rudolfkoenig $
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
sub err($$);
|
||||
|
||||
my $svnlook='/usr/bin/svnlook';
|
||||
my $repos=$ARGV[0];
|
||||
my $txn=$ARGV[1];
|
||||
my $arg="-t $txn";
|
||||
#my $arg="-r $txn"; # local testing
|
||||
my @lang = ("EN", "DE");
|
||||
my $exitCode = 0;
|
||||
use constant TAGS => qw{ul li code b};
|
||||
|
||||
|
||||
my $log = `$svnlook log $arg $repos`;
|
||||
if($log !~ m/^.*:.*$/s) {
|
||||
print << 'EOF';
|
||||
A FHEM SVN comment must have the following format
|
||||
module: text-describing-the-change
|
||||
or
|
||||
module: text-describing-the-change (Forum #<forum.fhem.de threadnumber>)
|
||||
EOF
|
||||
exit(1);
|
||||
}
|
||||
|
||||
my $fList = `$svnlook changed $arg $repos`;
|
||||
foreach my $row (split("\n", $fList)) {
|
||||
chomp($row);
|
||||
my ($type, $fName) = split(" ", $row);
|
||||
next if(!$fName || $fName !~ m+FHEM/\d\d_(.*).pm$+);
|
||||
my $modName = $1;
|
||||
|
||||
foreach my $lang (@lang) {
|
||||
my $suffix = ($lang eq "EN" ? "" : "_$lang");
|
||||
my $tag;
|
||||
my %tagcount= ();
|
||||
my %llwct = (); # Last line with closed tag
|
||||
open(MOD, "$svnlook $arg cat $repos $fName|") ||
|
||||
die("Cant svnlook cat $fName:$!\n");
|
||||
my $skip = 1;
|
||||
my $line = 0;
|
||||
my $docCount = 0;
|
||||
my $hasLink = 0;
|
||||
while(my $l = <MOD>) {
|
||||
$line++;
|
||||
|
||||
err $fName, "DOS line encoding is not supported."
|
||||
if($l =~ m/^=begin html$suffix.*\r/);
|
||||
|
||||
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.")
|
||||
if($l =~ m/^...*$/);
|
||||
$skip = 0; $line++;
|
||||
|
||||
} elsif($l =~ m/^=end html$suffix$/) {
|
||||
$skip = 1;
|
||||
|
||||
} elsif(!$skip) {
|
||||
$docCount++;
|
||||
$hasLink = ($l =~ m/<a name="$modName"/) if(!$hasLink);
|
||||
foreach $tag (TAGS) {
|
||||
my $ot = ($tagcount{$tag} ? $tagcount{$tag} : 0);
|
||||
$tagcount{$tag} +=()= ($l =~ /<$tag>/gi);
|
||||
$tagcount{$tag} -=()= ($l =~ /<\/$tag>/gi);
|
||||
$llwct{$tag} = $line if(!$llwct{$tag} || ($ot && !$tagcount{$tag}));
|
||||
}
|
||||
}
|
||||
}
|
||||
close(MOD);
|
||||
|
||||
err $fName, "$lang: No document text found"
|
||||
if(!$suffix && !$docCount);
|
||||
err $fName, "$lang: No <a name=\"$modName\"> link"
|
||||
if(!$suffix && $docCount && !$hasLink);
|
||||
foreach $tag (TAGS) {
|
||||
err $fName, "$lang: Unbalanced $tag ($tagcount{$tag}, last line ok: $llwct{$tag})"
|
||||
if($tagcount{$tag});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit($exitCode);
|
||||
|
||||
sub
|
||||
err($$)
|
||||
{
|
||||
my ($fName, $txt) = @_;
|
||||
print "*** $fName: $txt\n";
|
||||
$exitCode = 1;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user