OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /e/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-re Date: 08-Jul-2003 19:04:32 Branch: HEAD Handle: 2003070818043100 Modified files: openpkg-re speclint.pl Log: add one more check for comment start character; update license check; add still decactivated line length check Summary: Revision Changes Path 1.29 +27 -3 openpkg-re/speclint.pl ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-re/speclint.pl ============================================================================ $ cvs diff -u -r1.28 -r1.29 speclint.pl --- openpkg-re/speclint.pl 7 Jul 2003 11:50:44 -0000 1.28 +++ openpkg-re/speclint.pl 8 Jul 2003 17:04:31 -0000 1.29 @@ -5,7 +5,7 @@ ## speclint -- OpenPKG .spec File Checker ## Copyright (c) 2003 The OpenPKG Project <http://www.openpkg.org/> ## Copyright (c) 2003 Ralf S. Engelschall <[EMAIL PROTECTED]> -## Copyright (c) 2003 Cable & Wireless Germany <http://www.cw.com/de> +## Copyright (c) 2003 Cable & Wireless <http://www.cw.com/> ## ## Permission to use, copy, modify, and distribute this software for ## any purpose with or without fee is hereby granted, provided that @@ -252,7 +252,7 @@ sub check_comment { my ($file, $spec) = @_; - # check for comment indentation + # check for comment indentation and contents my $done = ''; my $this = ''; my $todo = $spec; while ($todo =~ m/^([ \t]*)(#+)([ \t]*)(.*?)$/m) { $done .= $`; $this = $&; $todo = $'; @@ -274,6 +274,19 @@ } $done .= $this; } + + # check for comment contents only + if ($file !~ m|openpkg\.spec$|) { + $done = ''; $this = ''; $todo = $spec; + while ($todo =~ m/\n\n[ \t]*#[ \t]+([^\n]+)(?!\n([ \t]*#))/s) { + $done .= $`; $this = $&; $todo = $'; + my $text = $1; + if (length($text) > 0 and $text =~ m|^[A-Z][^A-Z]|) { + &lint_warning($file, $done, $this, "comment text starts with upper-case letter (expected lower-case letter)"); + } + $done .= $this; + } + } } ## _________________________________________________________________ @@ -288,9 +301,9 @@ my $re = ""; $re .= "##\\n"; $re .= "## [a-z][a-z0-9-]+\\.spec -- OpenPKG RPM Specification\\n"; - $re .= "## Copyright \\(c\\) 200[0-3]-200[0-3] Cable \\& Wireless Deutschland GmbH\\n"; $re .= "## Copyright \\(c\\) 200[0-3]-200[0-3] The OpenPKG Project <http://www\\.openpkg\\.org/>\\n"; $re .= "## Copyright \\(c\\) 200[0-3]-200[0-3] Ralf S\\. Engelschall <[EMAIL PROTECTED]>\\n"; + $re .= "## Copyright \\(c\\) 200[0-3]-200[0-3] Cable \\& Wireless <http://www.cw.com/>\\n"; $re .= "##\\n"; $re .= "## Permission to use, copy, modify, and distribute this software for\\n"; $re .= "## any purpose with or without fee is hereby granted, provided that\\n"; @@ -782,6 +795,7 @@ sub check_global { my ($file, $spec) = @_; + # check for deprecated use of %{name} macro my $done = ''; my $this = ''; my $todo = $spec; while ($todo =~ m/\%\{name\}/s) { $done .= $`; $this = $&; $todo = $'; @@ -789,5 +803,15 @@ &lint_warning($file, $done, $this, "deprecated usage of %{name} macro (expected none)"); $done .= $this; } + + # FIXME: activate later + # check for over-long lines + #$done = ''; $this = ''; $todo = $spec; + #while ($todo =~ m/([^\n]{78,})\n/s) { + # $done .= $`; $this = $&; $todo = $'; + # &lint_warning($file, $done, $this, "over-long line with ".sprintf("%d", length($1))." characters " . + # "(expected maximum of 78 characters)"); + # $done .= $this; + #} } @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List [EMAIL PROTECTED]