OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Thomas Lotterer
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-re Date: 08-Jul-2003 21:44:31
Branch: HEAD Handle: 2003070820443000
Modified files:
openpkg-re rclint.pl
Log:
add command section order check
Summary:
Revision Changes Path
1.2 +43 -0 openpkg-re/rclint.pl
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-re/rclint.pl
============================================================================
$ cvs diff -u -r1.1 -r1.2 rclint.pl
--- openpkg-re/rclint.pl 7 Jul 2003 22:11:24 -0000 1.1
+++ openpkg-re/rclint.pl 8 Jul 2003 19:44:30 -0000 1.2
@@ -100,6 +100,7 @@
my @check_list = (qw(
blank
comment
+ section
));
my @checks = ();
if ($check eq 'all') {
@@ -282,6 +283,48 @@
&lint_warning($file, $done, $this, "empty comment text (expected a
reasonable text)");
}
$done .= $this;
+ }
+}
+
+## _________________________________________________________________
+##
+## CHECK "section": run command sections
+## _________________________________________________________________
+##
+
+sub check_section {
+ my ($file, $spec) = @_;
+
+ my $require = qq{
+ (%config,)?
+ (%info,)?
+ (%common,)?
+ (%status,)?
+ (%start,)?
+ (%stop,)?
+ (%restart,)?
+ (%reload,)?
+ (%quarterly,)?
+ (%hourly,)?
+ (%daily,)?
+ (%weekly,)?
+ (%env,)?
+ };
+
+ # check for order of headers
+ my $sections = "";
+ my $done = ''; my $this = ''; my $todo = $spec;
+ while ($todo =~ m/^(\S+:|%\S+).*$/m) {
+ $done .= $`; $this = $&; $todo = $';
+ my $section = $1;
+ $sections .= "$section,";
+ $done .= $this;
+ }
+ my $regex = $require;
+ $regex =~ s|\s+||sg;
+ if ($sections !~ m/^$regex$/s) {
+ $regex =~ s|,| |sg;
+ &lint_error($file, undef, undef, "invalid run command section order
(expected \"$regex\")");
}
}
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]