]> git.ipfire.org Git - thirdparty/git.git/commitdiff
chainlint: make error messages self-explanatory
authorEric Sunshine <sunshine@sunshineco.com>
Tue, 10 Sep 2024 04:10:12 +0000 (00:10 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 Sep 2024 17:01:40 +0000 (10:01 -0700)
The annotations emitted by chainlint to indicate detected problems are
overly terse, so much so that developers new to the project -- those who
should most benefit from the linting -- may find them baffling. For
instance, although the author of chainlint and seasoned Git developers
may understand that "?!AMP?!" is an abbreviation of "ampersand" and
indicates a break in the &&-chain, this may not be obvious to newcomers.

The "?!LOOP?!" case is particularly serious because that terse single
word does nothing to convey that the loop body should end with
"|| return 1" (or "|| exit 1" in a subshell) to ensure that a failing
command in the body aborts the loop immediately. Moreover, unlike
&&-chaining which is ubiquitous in Git tests, the "|| return 1" idiom is
relatively infrequent, thus may be harder for a newcomer to discover by
consulting nearby code.

Address these shortcomings by emitting human-readable messages which
both explain the problem and give a strong hint about how to correct it.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
44 files changed:
t/chainlint.pl
t/chainlint/arithmetic-expansion.expect
t/chainlint/block.expect
t/chainlint/broken-chain.expect
t/chainlint/case.expect
t/chainlint/chain-break-false.expect
t/chainlint/chained-block.expect
t/chainlint/chained-subshell.expect
t/chainlint/command-substitution.expect
t/chainlint/complex-if-in-cuddled-loop.expect
t/chainlint/cuddled.expect
t/chainlint/for-loop.expect
t/chainlint/function.expect
t/chainlint/here-doc-body-indent.expect
t/chainlint/here-doc-body-pathological.expect
t/chainlint/here-doc-body.expect
t/chainlint/here-doc-double.expect
t/chainlint/here-doc-indent-operator.expect
t/chainlint/here-doc-multi-line-command-subst.expect
t/chainlint/here-doc-multi-line-string.expect
t/chainlint/if-condition-split.expect
t/chainlint/if-in-loop.expect
t/chainlint/if-then-else.expect
t/chainlint/inline-comment.expect
t/chainlint/loop-detect-failure.expect
t/chainlint/loop-in-if.expect
t/chainlint/multi-line-string.expect
t/chainlint/negated-one-liner.expect
t/chainlint/nested-cuddled-subshell.expect
t/chainlint/nested-here-doc.expect
t/chainlint/nested-loop-detect-failure.expect
t/chainlint/nested-subshell-comment.expect
t/chainlint/nested-subshell.expect
t/chainlint/not-heredoc.expect
t/chainlint/one-liner-for-loop.expect
t/chainlint/one-liner.expect
t/chainlint/pipe.expect
t/chainlint/semicolon.expect
t/chainlint/subshell-here-doc.expect
t/chainlint/subshell-one-liner.expect
t/chainlint/token-pasting.expect
t/chainlint/unclosed-here-doc-indent.expect
t/chainlint/unclosed-here-doc.expect
t/chainlint/while-loop.expect

index 1a7611ad43c44ace7bfb57ad7a17ad896c3534db..ad264994781c5155d54cb1faceea14ccc60e0720 100755 (executable)
@@ -9,9 +9,9 @@
 # Input arguments are pathnames of shell scripts containing test definitions,
 # or globs referencing a collection of scripts. For each problem discovered,
 # the pathname of the script containing the test is printed along with the test
-# name and the test body with a `?!FOO?!` annotation at the location of each
-# detected problem, where "FOO" is a tag such as "AMP" which indicates a broken
-# &&-chain. Returns zero if no problems are discovered, otherwise non-zero.
+# name and the test body with a `?!LINT: ...?!` annotation at the location of
+# each detected problem, where "..." is an explanation of the problem. Returns
+# zero if no problems are discovered, otherwise non-zero.
 
 use warnings;
 use strict;
@@ -181,7 +181,7 @@ sub swallow_heredocs {
                        $self->{lineno} += () = $body =~ /\n/sg;
                        next;
                }
-               push(@{$self->{parser}->{problems}}, ['UNCLOSED-HEREDOC', $tag]);
+               push(@{$self->{parser}->{problems}}, ['HEREDOC', $tag]);
                $$b =~ /(?:\G|\n).*\z/gc; # consume rest of input
                my $body = substr($$b, $start, pos($$b) - $start);
                $self->{lineno} += () = $body =~ /\n/sg;
@@ -238,6 +238,7 @@ sub new {
                stop => [],
                output => [],
                heredocs => {},
+               insubshell => 0,
        } => $class;
        $self->{lexer} = Lexer->new($self, $s);
        return $self;
@@ -296,8 +297,11 @@ sub parse_group {
 
 sub parse_subshell {
        my $self = shift @_;
-       return ($self->parse(qr/^\)$/),
-               $self->expect(')'));
+       $self->{insubshell}++;
+       my @tokens = ($self->parse(qr/^\)$/),
+                     $self->expect(')'));
+       $self->{insubshell}--;
+       return @tokens;
 }
 
 sub parse_case_pattern {
@@ -528,7 +532,7 @@ sub parse_loop_body {
        return @tokens if ends_with(\@tokens, [qr/^\|\|$/, "\n", qr/^echo$/, qr/^.+$/]);
        # flag missing "return/exit" handling explicit failure in loop body
        my $n = find_non_nl(\@tokens);
-       push(@{$self->{problems}}, ['LOOP', $tokens[$n]]);
+       push(@{$self->{problems}}, [$self->{insubshell} ? 'LOOPEXIT' : 'LOOPRETURN', $tokens[$n]]);
        return @tokens;
 }
 
@@ -620,6 +624,15 @@ sub unwrap {
        return $s
 }
 
+sub format_problem {
+       local $_ = shift;
+       /^AMP$/ && return "missing '&&'";
+       /^LOOPRETURN$/ && return "missing '|| return 1'";
+       /^LOOPEXIT$/ && return "missing '|| exit 1'";
+       /^HEREDOC$/ && return 'unclosed heredoc';
+       die("unrecognized problem type '$_'\n");
+}
+
 sub check_test {
        my $self = shift @_;
        my $title = unwrap(shift @_);
@@ -643,9 +656,10 @@ sub check_test {
        for (sort {$a->[1]->[2] <=> $b->[1]->[2]} @$problems) {
                my ($label, $token) = @$_;
                my $pos = $token->[2];
+               my $err = format_problem($label);
                $checked .= substr($body, $start, $pos - $start);
                $checked .= ' ' unless $checked =~ /\s$/;
-               $checked .= "$c->{rev}$c->{red}?!$label?!$c->{reset}";
+               $checked .= "$c->{rev}$c->{red}?!LINT: $err?!$c->{reset}";
                $checked .= ' ' unless $pos >= length($body) ||
                    substr($body, $pos, 1) =~ /^\s/;
                $start = $pos;
index 338ecd5861271afe26fe58f628e77b816ab90931..5677e16cad6146a6765d252f8415129481481144 100644 (file)
@@ -4,6 +4,6 @@
 5      baz
 6 ) &&
 7 (
-8      bar=$((42 + 1)) ?!AMP?!
+8      bar=$((42 + 1)) ?!LINT: missing '&&'?!
 9      baz
 10 )
index b62e3d58c36b9bb35cd52e33712c07764835c3b7..3d3f854c0d654dea495c78ecad1eddc7317cb832 100644 (file)
@@ -1,20 +1,20 @@
 2 (
 3      foo &&
 4      {
-5              echo a ?!AMP?!
+5              echo a ?!LINT: missing '&&'?!
 6              echo b
 7      } &&
 8      bar &&
 9      {
 10             echo c
-11     } ?!AMP?!
+11     } ?!LINT: missing '&&'?!
 12     baz
 13 ) &&
 14 
 15 {
-16     echo a; ?!AMP?! echo b
+16     echo a; ?!LINT: missing '&&'?! echo b
 17 } &&
-18 { echo a; ?!AMP?! echo b; } &&
+18 { echo a; ?!LINT: missing '&&'?! echo b; } &&
 19 
 20 {
 21     echo "${var}9" &&
index 9a1838736f9f7666829e0952fa82d752733fd4a2..b7b1ce8509b726ae4e22824d72da39eaa8ef48d7 100644 (file)
@@ -1,6 +1,6 @@
 2 (
 3      foo &&
-4      bar ?!AMP?!
+4      bar ?!LINT: missing '&&'?!
 5      baz &&
 6      wop
 7 )
index c04c61ff36668cdadf127369d0122e63788f7aae..0a3b09e47091c5a5011351f680e896ff058ad2da 100644 (file)
@@ -9,11 +9,11 @@
 10     case "$x" in
 11     x) foo ;;
 12     *) bar ;;
-13     esac ?!AMP?!
+13     esac ?!LINT: missing '&&'?!
 14     foobar
 15 ) &&
 16 (
 17     case "$x" in 1) true;; esac &&
-18     case "$y" in 2) false;; esac ?!AMP?!
+18     case "$y" in 2) false;; esac ?!LINT: missing '&&'?!
 19     foobar
 20 )
index 4f815f8e14c1a2e396171d003598f183c583edcb..f6a0a301e98ae1028aa2142094252dfd1ece91ff 100644 (file)
@@ -4,6 +4,6 @@
 5      echo failed!
 6      false
 7 else
-8      echo it went okay ?!AMP?!
+8      echo it went okay ?!LINT: missing '&&'?!
 9      congratulate user
 10 fi
index a546b714a69c4960ac75a228a9aa6fe5f5634030..f2501bba90416a5d4eea91931574b4271619879d 100644 (file)
@@ -1,5 +1,5 @@
 2 echo nobody home && {
-3      test the doohicky ?!AMP?!
+3      test the doohicky ?!LINT: missing '&&'?!
 4      right now
 5 } &&
 6 
index f78b268291c7ac1dbad6241a1bb315b6fc288d1c..93fb1a6578b86e165d995ada27d5adf44cf3a9c1 100644 (file)
@@ -1,10 +1,10 @@
 2 mkdir sub && (
 3      cd sub &&
-4      foo the bar ?!AMP?!
+4      foo the bar ?!LINT: missing '&&'?!
 5      nuff said
 6 ) &&
 7 
 8 cut "-d " -f actual | (read s1 s2 s3 &&
-9 test -f $s1 ?!AMP?!
+9 test -f $s1 ?!LINT: missing '&&'?!
 10 test $(cat $s2) = tree2path1 &&
 11 test $(cat $s3) = tree3path1)
index 5e31b36db65bb9ffda850039f50b03dbd86a9ea5..73809fd585447f73c869e65266ec7560eaa83da4 100644 (file)
@@ -4,6 +4,6 @@
 5      baz
 6 ) &&
 7 (
-8      bar=$(gobble blocks) ?!AMP?!
+8      bar=$(gobble blocks) ?!LINT: missing '&&'?!
 9      baz
 10 )
index 3a740103db19f675c09d382da83b64f8d8647e36..e66bb2d5d01f4627366b13e44e414b73f531de7a 100644 (file)
@@ -4,6 +4,6 @@
 5      :
 6    else
 7      echo >file
-8    fi ?!LOOP?!
+8    fi ?!LINT: missing '|| exit 1'?!
 9  done) &&
 10 test ! -f file
index b06d6383116c351aa56669e76861d7d33fb820e4..1864b3fc8b2d7e62ed1f560113e42cc41a2fdfac 100644 (file)
@@ -2,7 +2,7 @@
 3      bar
 4 ) &&
 5 
-6 (cd foo ?!AMP?!
+6 (cd foo ?!LINT: missing '&&'?!
 7      bar
 8 ) &&
 9 
@@ -13,5 +13,5 @@
 14 (cd foo &&
 15     bar) &&
 16 
-17 (cd foo ?!AMP?!
+17 (cd foo ?!LINT: missing '&&'?!
 18     bar)
index 908aeedf96ef74b58ab9eabf2efc437b424d992f..5029eacce34c48e99b1bfece576fa97baec874d5 100644 (file)
@@ -1,14 +1,14 @@
 2 (
 3      for i in a b c
 4      do
-5              echo $i ?!AMP?!
-6              cat <<-\EOF ?!LOOP?!
+5              echo $i ?!LINT: missing '&&'?!
+6              cat <<-\EOF ?!LINT: missing '|| exit 1'?!
 7              bar
 8              EOF
-9      done ?!AMP?!
+9      done ?!LINT: missing '&&'?!
 10 
 11     for i in a b c; do
 12             echo $i &&
-13             cat $i ?!LOOP?!
+13             cat $i ?!LINT: missing '|| exit 1'?!
 14     done
 15 )
index c226246b2595fa87c81e62ae508c75cef25676a4..9e46a3554a1149b8b8cc18884d41288eff703994 100644 (file)
@@ -4,8 +4,8 @@
 5 
 6 remove_object() {
 7      file=$(sha1_file "$*") &&
-8      test -e "$file" ?!AMP?!
+8      test -e "$file" ?!LINT: missing '&&'?!
 9      rm -f "$file"
-10 } ?!AMP?!
+10 } ?!LINT: missing '&&'?!
 11 
 12 sha1_file arg && remove_object arg
index 4323acc93d5cb77f77b0ec23e82ed0a8f47e7282..4306faee8611f7d0d54890bf45eec8de7308f6da 100644 (file)
@@ -1,2 +1,2 @@
-2      echo "we should find this" ?!AMP?!
+2      echo "we should find this" ?!LINT: missing '&&'?!
 3      echo "even though our heredoc has its indent stripped"
index a93a1fa3aafe2712c6b50b1df09203ca33fbfa7c..2f8ea03a47daf8a7d9a5e4e8379035b43d607885 100644 (file)
@@ -1,7 +1,7 @@
-2      echo "outer here-doc does not allow indented end-tag" ?!AMP?!
+2      echo "outer here-doc does not allow indented end-tag" ?!LINT: missing '&&'?!
 3      cat >file <<-\EOF &&
 4      but this inner here-doc
 5      does allow indented EOF
 6      EOF
-7      echo "missing chain after" ?!AMP?!
+7      echo "missing chain after" ?!LINT: missing '&&'?!
 8      echo "but this line is OK because it's the end"
index ddf1c412af5a24267213e577c7db3eb0c799f2c6..df8d79bc0a1650d2880bcc8580c00bae42a268a9 100644 (file)
@@ -1,7 +1,7 @@
-2      echo "missing chain before" ?!AMP?!
+2      echo "missing chain before" ?!LINT: missing '&&'?!
 3      cat >file <<-\EOF &&
 4      inside inner here-doc
 5      these are not shell commands
 6      EOF
-7      echo "missing chain after" ?!AMP?!
+7      echo "missing chain after" ?!LINT: missing '&&'?!
 8      echo "but this line is OK because it's the end"
index 20dba4b452114bb00e7b06b075c1047fb651fcf8..e5e981889f51f598dec590f5a13fdc1b5b067420 100644 (file)
@@ -1,2 +1,2 @@
-8      echo "actual test commands" ?!AMP?!
+8      echo "actual test commands" ?!LINT: missing '&&'?!
 9      echo "that should be checked"
index 277a11202d7b131456f71cddebdb52ad9e627e10..ec0e61505b75b4480db462013472c93a7fc17761 100644 (file)
@@ -4,7 +4,7 @@
 5 chunks: oid_fanout oid_lookup commit_metadata generation_data bloom_indexes bloom_data
 6 EOF
 7 
-8 cat >expect << -EOF ?!AMP?!
+8 cat >expect << -EOF ?!LINT: missing '&&'?!
 9 this is not indented
 10 -EOF
 11 
index 41b55f6437303b70cd21dc8b66d4306ddb1d3ff4..8128f15b92d35b839294623d47776f0eb63189a0 100644 (file)
@@ -3,6 +3,6 @@
 4              fossil
 5              vegetable
 6              END
-7              wiffle) ?!AMP?!
+7              wiffle) ?!LINT: missing '&&'?!
 8      echo $x
 9 )
index c71828589e57c691dfb47105f2464928e503eea8..a03a04ff3d9f8650b8d5d4873b9997d9eb6db670 100644 (file)
@@ -1,6 +1,6 @@
 2 (
 3      cat <<-\TXT && echo "multi-line
-4      string" ?!AMP?!
+4      string" ?!LINT: missing '&&'?!
 5      fizzle
 6      TXT
 7      bap
index 9daf3d294af3288a829b5d8362e85600a3a41371..6d2a03dfdb2f4f0bc15420fd1054b49c1b7df0d6 100644 (file)
@@ -2,6 +2,6 @@
 3    marcia ||
 4    kevin
 5 then
-6      echo "nomads" ?!AMP?!
+6      echo "nomads" ?!LINT: missing '&&'?!
 7      echo "for sure"
 8 fi
index ff8c60dbdb026cd57216020e1506cf2378c6e4a7..7e3ba740de679c74c7caadff64d4e5a60858f53c 100644 (file)
@@ -5,8 +5,8 @@
 6              then
 7                      echo "err"
 8                      exit 1
-9              fi ?!AMP?!
+9              fi ?!LINT: missing '&&'?!
 10             foo
-11     done ?!AMP?!
+11     done ?!LINT: missing '&&'?!
 12     bar
 13 )
index 965d7e41a2ce75e520940dfa9b4e489f261a9449..924caa2e4eaa10e74d60b101cbad237ec963372f 100644 (file)
@@ -1,7 +1,7 @@
 2 (
 3      if test -n ""
 4      then
-5              echo very ?!AMP?!
+5              echo very ?!LINT: missing '&&'?!
 6              echo empty
 7      elif test -z ""
 8      then
@@ -11,7 +11,7 @@
 12             cat <<-\EOF
 13             bar
 14             EOF
-15     fi ?!AMP?!
+15     fi ?!LINT: missing '&&'?!
 16     echo poodle
 17 ) &&
 18 (
index 0285c0b22c9802aa7418c5518c529dce53c6cf33..4b4080124e94a9d85f97b8fc1ca7d6207fee59a6 100644 (file)
@@ -1,6 +1,6 @@
 2 (
 3      foobar && # comment 1
-4      barfoo ?!AMP?! # wrong position for &&
+4      barfoo ?!LINT: missing '&&'?! # wrong position for &&
 5      flibble "not a # comment"
 6 ) &&
 7 
index 40c06f0d5397abc5c977e5f91d479d0f400cea2f..7d846b878d6577695bc721a4f6055e22bb065253 100644 (file)
@@ -11,5 +11,5 @@
 12 do
 13     printf "%"$n"s" X > r2/large.$n &&
 14     git -C r2 add large.$n &&
-15     git -C r2 commit -m "$n" ?!LOOP?!
+15     git -C r2 commit -m "$n" ?!LINT: missing '|| return 1'?!
 16 done
index 4e8c67c91493a6ed80f26ffc868c20438329fadc..32e076ad1be59bc6aa86df58cbeed101545e1a34 100644 (file)
@@ -3,10 +3,10 @@
 4      then
 5              while true
 6              do
-7                      echo "pop" ?!AMP?!
-8                      echo "glup" ?!LOOP?!
-9              done ?!AMP?!
+7                      echo "pop" ?!LINT: missing '&&'?!
+8                      echo "glup" ?!LINT: missing '|| exit 1'?!
+9              done ?!LINT: missing '&&'?!
 10             foo
-11     fi ?!AMP?!
+11     fi ?!LINT: missing '&&'?!
 12     bar
 13 )
index 62c54e3a5e879f870bc0e554d481fc51dc304808..9d332975258ad348dcb128b80bb3f24cc24b51b7 100644 (file)
@@ -3,7 +3,7 @@
 4              line 2
 5              line 3" &&
 6      y="line 1
-7              line2" ?!AMP?!
+7              line2" ?!LINT: missing '&&'?!
 8      foobar
 9 ) &&
 10 (
index a6ce52a1da809c8b37e92942df96d3bb1095070f..0a6f3c29b2a4cd201b4b1143a8990ef529ccf8e3 100644 (file)
@@ -1,5 +1,5 @@
 2 ! (foo && bar) &&
 3 ! (foo && bar) >baz &&
 4 
-5 ! (foo; ?!AMP?! bar) &&
-6 ! (foo; ?!AMP?! bar) >baz
+5 ! (foo; ?!LINT: missing '&&'?! bar) &&
+6 ! (foo; ?!LINT: missing '&&'?! bar) >baz
index 0191c9c2948b43245d17a8f6ea2638af1308a6c8..fec2c74274b7940e9c6e76a4b39be16dd460308c 100644 (file)
@@ -5,7 +5,7 @@
 6 
 7      (cd foo &&
 8              bar
-9      ) ?!AMP?!
+9      ) ?!LINT: missing '&&'?!
 10 
 11     (
 12             cd foo &&
 14 
 15     (
 16             cd foo &&
-17             bar) ?!AMP?!
+17             bar) ?!LINT: missing '&&'?!
 18 
 19     (cd foo &&
 20             bar) &&
 21 
 22     (cd foo &&
-23             bar) ?!AMP?!
+23             bar) ?!LINT: missing '&&'?!
 24 
 25     foobar
 26 )
index 70d9b68dc95681d4218f854191f654c84bd1d2ed..571f4c9514e36aff18028bb51fcc414c5e91d852 100644 (file)
@@ -18,7 +18,7 @@
 19     toink
 20     INPUT_END
 21 
-22     cat <<-\EOT ?!AMP?!
+22     cat <<-\EOT ?!LINT: missing '&&'?!
 23     text goes here
 24     data <<EOF
 25             data goes here
index c13c4d2f90afc5ff2ded16244c61366d0fef274e..b4aaa621a2ced84bc67acf1ea3965cdc7413d74b 100644 (file)
@@ -2,8 +2,8 @@
 3 do
 4      for j in 0 1 2 3 4 5 6 7 8 9;
 5      do
-6              echo "$i$j" >"path$i$j" ?!LOOP?!
-7      done ?!LOOP?!
+6              echo "$i$j" >"path$i$j" ?!LINT: missing '|| return 1'?!
+7      done ?!LINT: missing '|| return 1'?!
 8 done &&
 9 
 10 for i in 0 1 2 3 4 5 6 7 8 9;
@@ -18,7 +18,7 @@
 19 do
 20     for j in 0 1 2 3 4 5 6 7 8 9;
 21     do
-22             echo "$i$j" >"path$i$j" ?!LOOP?!
+22             echo "$i$j" >"path$i$j" ?!LINT: missing '|| return 1'?!
 23     done || return 1
 24 done &&
 25 
index f89a8d03a85304fc04e1985616f7c35978177ec5..078c6f275f053c01d90138bced292faa90e5643f 100644 (file)
@@ -6,6 +6,6 @@
 7              # minor numbers of cows (or do they?)
 8              baz &&
 9              snaff
-10     ) ?!AMP?!
+10     ) ?!LINT: missing '&&'?!
 11     fuzzy
 12 )
index 811e8a79129ec50aa8a881135bb3e66594f1c2e1..a8d85d5d5b6e88dc5e9056b6846cb89d52059490 100644 (file)
@@ -7,7 +7,7 @@
 8 
 9      cd foo &&
 10     (
-11             echo a ?!AMP?!
+11             echo a ?!LINT: missing '&&'?!
 12             echo b
 13     ) >file
 14 )
index 611b7b75cb1e6678fa27e364f6afbf437b65d71d..5d51705a7a2cf3fe4b671e99adb147b2a7698778 100644 (file)
@@ -9,6 +9,6 @@
 10     echo ourside &&
 11     echo "=======" &&
 12     echo theirside &&
-13     echo ">>>>>>> theirs" ?!AMP?!
+13     echo ">>>>>>> theirs" ?!LINT: missing '&&'?!
 14     poodle
 15 ) >merged
index 49dcf065efb00a7d2310148f302718c780ffd0ae..e1fcbd363917d3711e3b2dcfd8ffb66c4c60fffe 100644 (file)
@@ -3,7 +3,7 @@
 4      cd dir-rename-and-content &&
 5      test_write_lines 1 2 3 4 5 >foo &&
 6      mkdir olddir &&
-7      for i in a b c; do echo $i >olddir/$i; ?!LOOP?! done ?!AMP?!
+7      for i in a b c; do echo $i >olddir/$i; ?!LINT: missing '|| exit 1'?! done ?!LINT: missing '&&'?!
 8      git add foo olddir &&
 9      git commit -m "original" &&
 10 )
index 986181128383d3fc90584c10c7050f36cde5f6e2..5deeb050707cb3d3fc9b813a80d9d32c5ddb8648 100644 (file)
@@ -2,8 +2,8 @@
 3 (foo && bar) |
 4 (foo && bar) >baz &&
 5 
-6 (foo; ?!AMP?! bar) &&
-7 (foo; ?!AMP?! bar) |
-8 (foo; ?!AMP?! bar) >baz &&
+6 (foo; ?!LINT: missing '&&'?! bar) &&
+7 (foo; ?!LINT: missing '&&'?! bar) |
+8 (foo; ?!LINT: missing '&&'?! bar) >baz &&
 9 
 10 (foo "bar; baz")
index 1bbe5a2ce172c05e9b6231e2180d0426b3eca4e3..d947c765840348db6cb2c9be5ea0d60266a7e6af 100644 (file)
@@ -4,7 +4,7 @@
 5      baz &&
 6 
 7      fish |
-8      cow ?!AMP?!
+8      cow ?!LINT: missing '&&'?!
 9 
 10     sunder
 11 )
index 866438310ca3387af7ca734fa0c82c3a53a78b40..2b499fbe70c56c5c0cc1550ab33e47d6033ad524 100644 (file)
@@ -1,19 +1,19 @@
 2 (
-3      cat foo ; ?!AMP?! echo bar ?!AMP?!
-4      cat foo ; ?!AMP?! echo bar
+3      cat foo ; ?!LINT: missing '&&'?! echo bar ?!LINT: missing '&&'?!
+4      cat foo ; ?!LINT: missing '&&'?! echo bar
 5 ) &&
 6 (
-7      cat foo ; ?!AMP?! echo bar &&
-8      cat foo ; ?!AMP?! echo bar
+7      cat foo ; ?!LINT: missing '&&'?! echo bar &&
+8      cat foo ; ?!LINT: missing '&&'?! echo bar
 9 ) &&
 10 (
 11     echo "foo; bar" &&
-12     cat foo; ?!AMP?! echo bar
+12     cat foo; ?!LINT: missing '&&'?! echo bar
 13 ) &&
 14 (
 15     foo;
 16 ) &&
 17 (cd foo &&
 18     for i in a b c; do
-19             echo; ?!LOOP?!
+19             echo; ?!LINT: missing '|| exit 1'?!
 20     done)
index 5647500c82ff7548ae950525e3cb4a57f4e1992d..e450caf948490432a2143926fb0d85c08ff14851 100644 (file)
@@ -6,7 +6,7 @@
 7      nevermore...
 8      EOF
 9 
-10     cat <<EOF >bip ?!AMP?!
+10     cat <<EOF >bip ?!LINT: missing '&&'?!
 11     fish fly high
 12 EOF
 13 
index 214316c6a06d7c460c67675186bc34a4ef17ba5b..265d996a211a538f43af27004350f6af38fb6b4f 100644 (file)
@@ -3,17 +3,17 @@
 4      (foo && bar) |
 5      (foo && bar) >baz &&
 6 
-7      (foo; ?!AMP?! bar) &&
-8      (foo; ?!AMP?! bar) |
-9      (foo; ?!AMP?! bar) >baz &&
+7      (foo; ?!LINT: missing '&&'?! bar) &&
+8      (foo; ?!LINT: missing '&&'?! bar) |
+9      (foo; ?!LINT: missing '&&'?! bar) >baz &&
 10 
 11     (foo || exit 1) &&
 12     (foo || exit 1) |
 13     (foo || exit 1) >baz &&
 14 
-15     (foo && bar) ?!AMP?!
+15     (foo && bar) ?!LINT: missing '&&'?!
 16 
-17     (foo && bar; ?!AMP?! baz) ?!AMP?!
+17     (foo && bar; ?!LINT: missing '&&'?! baz) ?!LINT: missing '&&'?!
 18 
 19     foobar
 20 )
index 64f3235d262b777a1e2567e469e02d8663544974..387189b6de688e49df8de531d312d4af15755bd0 100644 (file)
@@ -2,13 +2,13 @@
 3 git config filter.rot13.clean ./rot13.sh &&
 4 
 5 {
-6     echo "*.t filter=rot13" ?!AMP?!
+6     echo "*.t filter=rot13" ?!LINT: missing '&&'?!
 7     echo "*.i ident"
 8 } >.gitattributes &&
 9 
 10 {
-11     echo a b c d e f g h i j k l m ?!AMP?!
-12     echo n o p q r s t u v w x y z ?!AMP?!
+11     echo a b c d e f g h i j k l m ?!LINT: missing '&&'?!
+12     echo n o p q r s t u v w x y z ?!LINT: missing '&&'?!
 13     echo '$Id$'
 14 } >test &&
 15 cat test >test.t &&
@@ -19,7 +19,7 @@
 20 git checkout -- test test.t test.i &&
 21 
 22 echo "content-test2" >test2.o &&
-23 echo "content-test3 - filename with special characters" >"test3 'sq',$x=.o" ?!AMP?!
+23 echo "content-test3 - filename with special characters" >"test3 'sq',$x=.o" ?!LINT: missing '&&'?!
 24 
 25 downstream_url_for_sed=$(
 26     printf "%sn" "$downstream_url" |
index f78e23cb632fc74b43f961365cbffb04a7f74c72..156906c85a5db1bba7dfb9ccc5d918ca5b47ff5a 100644 (file)
@@ -1,4 +1,4 @@
 2 command_which_is_run &&
-3 cat >expect <<-\EOF ?!UNCLOSED-HEREDOC?! &&
+3 cat >expect <<-\EOF ?!LINT: unclosed heredoc?! &&
 4 we forget to end the here-doc
 5 command_which_is_gobbled
index 51304672cfffef738e768a780cc7d0303c3ded04..752c608862474260a06a64f09ab0c80e8c3a8dd1 100644 (file)
@@ -1,5 +1,5 @@
 2 command_which_is_run &&
-3 cat >expect <<\EOF ?!UNCLOSED-HEREDOC?! &&
+3 cat >expect <<\EOF ?!LINT: unclosed heredoc?! &&
 4      we try to end the here-doc below,
 5      but the indentation throws us off
 6      since the operator is not "<<-".
index 5ffabd5a93fca9a598e5310d4bb5e0aad2291c9d..2ba55821654bb89fedfe5fc88ef4c0afff6300e9 100644 (file)
@@ -1,14 +1,14 @@
 2 (
 3      while true
 4      do
-5              echo foo ?!AMP?!
-6              cat <<-\EOF ?!LOOP?!
+5              echo foo ?!LINT: missing '&&'?!
+6              cat <<-\EOF ?!LINT: missing '|| exit 1'?!
 7              bar
 8              EOF
-9      done ?!AMP?!
+9      done ?!LINT: missing '&&'?!
 10 
 11     while true; do
 12             echo foo &&
-13             cat bar ?!LOOP?!
+13             cat bar ?!LINT: missing '|| exit 1'?!
 14     done
 15 )