pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files In variable assignments in the ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/013a8dc0f668
branches:  trunk
changeset: 535094:013a8dc0f668
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Wed Nov 07 17:01:24 2007 +0000

description:
In variable assignments in the shell you can sometimes leave out the
double quotes.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (25 lines):

diff -r 295e7ca5676a -r 013a8dc0f668 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Wed Nov 07 16:50:00 2007 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Wed Nov 07 17:01:24 2007 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.733 2007/11/07 16:47:27 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.734 2007/11/07 17:01:24 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -4286,6 +4286,14 @@
                        }
 
                } elsif ($state == SWST_PLAIN) {
+
+                       if ($rest =~ qr"([\w_]+)=\"\`") {
+                               $line->log_note("In the assignment to \"$1\", you don't need double quotes around backticks.");
+                               $line->explain_note(
+"Assignments are a special context, where no double quotes are needed",
+"around backticks. In other contexts, the double quotes are necessary.");
+                       }
+
                        if ($rest =~ s/^[!#\%&\(\)*+,\-.\/0-9:;<=>?\@A-Z\[\]^_a-z{|}~]+//) {
                        } elsif ($rest =~ s/^\'//) {
                                $state = SWST_SQUOT;



Home | Main Index | Thread Index | Old Index