pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint The diagnostics for the COMMENT varia...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c68a73e25af0
branches:  trunk
changeset: 499401:c68a73e25af0
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Sep 22 01:46:46 2005 +0000

description:
The diagnostics for the COMMENT variable checks include the location and
are therefore enabled by default. Requested by wiz.

Set the version to 4.21.1.

diffstat:

 pkgtools/pkglint/Makefile         |   4 +-
 pkgtools/pkglint/files/pkglint.pl |  43 ++++++++++++++++++++++----------------
 2 files changed, 27 insertions(+), 20 deletions(-)

diffs (94 lines):

diff -r 16dcad164c3e -r c68a73e25af0 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Thu Sep 22 01:41:14 2005 +0000
+++ b/pkgtools/pkglint/Makefile Thu Sep 22 01:46:46 2005 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.249 2005/09/09 12:16:29 rillig Exp $
+# $NetBSD: Makefile,v 1.250 2005/09/22 01:46:46 rillig Exp $
 #
 
-DISTNAME=      pkglint-4.21
+DISTNAME=      pkglint-4.21.1
 CATEGORIES=    pkgtools devel
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r 16dcad164c3e -r c68a73e25af0 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Thu Sep 22 01:41:14 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Thu Sep 22 01:46:46 2005 +0000
@@ -11,7 +11,7 @@
 # Freely redistributable.  Absolutely no warranty.
 #
 # From Id: portlint.pl,v 1.64 1998/02/28 02:34:05 itojun Exp
-# $NetBSD: pkglint.pl,v 1.283 2005/09/09 11:05:00 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.284 2005/09/22 01:46:46 rillig Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by:
@@ -1448,7 +1448,10 @@
        }
 }
 
-sub checklines_Makefile($) {
+# This subroutine contains "local" checks that can be made looking only
+# at a single line at a time. The other checks are in
+# checkfile_package_Makefile.
+sub checklines_package_Makefile($) {
        my ($lines) = @_;
 
        foreach my $line (@{$lines}) {
@@ -1463,6 +1466,25 @@
                if ($text =~ /^\040{8}/) {
                        $line->log_warning("Use tab (not spaces) to make indentation.");
                }
+
+               if ($text =~ $regex_varassign) {
+                       my ($varname, $op, $value) = ($1, $2, $3);
+
+                       if ($varname eq "COMMENT") {
+                               if ($value =~ qr"^(a|an)\s+"i) {
+                                       $line->log_warning("COMMENT should not begin with '$1'.");
+                               }
+                               if ($value =~ qr"^[a-z]") {
+                                       $line->log_warning("COMMENT should start with a capital letter.");
+                               }
+                               if ($value =~ qr"\.$") {
+                                       $line->log_warning("COMMENT should not end with a period.");
+                               }
+                               if (length($value) > 70) {
+                                       $line->log_warning("COMMENT should not be longer than 70 characters.");
+                               }
+                       }
+               }
        }
 
        checklines_trailing_empty_lines($lines);
@@ -1557,7 +1579,7 @@
        log_subinfo("checkfile_package_Makefile", $fname, NO_LINE_NUMBER, undef);
 
        checkperms($fname);
-       checklines_Makefile($lines);
+       checklines_package_Makefile($lines);
 
        $abspkgdir = Cwd::abs_path($dir);
        $category = basename(dirname($abspkgdir));
@@ -1878,21 +1900,6 @@
        # warnings for missing COMMENT
        if ($tmp !~ /\nCOMMENT=\s*(.*)$/) {
                $opt_warn_vague && log_error(NO_FILE, NO_LINE_NUMBER, "Please add a short COMMENT describing the package.");
-       } else {
-               # and its properties:
-               my $tmp2 = $1;
-               if ($tmp2 =~ /\.$/i) {
-                       $opt_warn_vague && log_warning(NO_FILE, NO_LINE_NUMBER, "COMMENT should not end with a '.' (period).");
-               }
-               if ($tmp2 =~ /^(a|an) /i) {
-                       $opt_warn_vague && log_warning(NO_FILE, NO_LINE_NUMBER, "COMMENT should not begin with '$1 '.");
-               }
-               if ($tmp2 =~ /^[a-z]/) {
-                       $opt_warn_vague && log_warning(NO_FILE, NO_LINE_NUMBER, "COMMENT should start with a capital letter.");
-               }
-               if (length($tmp2) > 70) {
-                       $opt_warn_vague && log_warning(NO_FILE, NO_LINE_NUMBER, "COMMENT should not be longer than 70 characters.");
-               }
        }
 
        checkearlier($tmp, @varnames);



Home | Main Index | Thread Index | Old Index