From 3042b6bb59787613e36e459bf60994a26bb5a5df Mon Sep 17 00:00:00 2001 From: Eric Sunshine Date: Wed, 29 Aug 2018 05:45:32 -0400 Subject: chainlint: match "quoted" here-doc tags A here-doc tag can be quoted ('EOF'/"EOF") or escaped (\EOF) to suppress interpolation within the body. chainlint recognizes single-quoted and escaped tags, but does not know about double-quoted tags. For completeness, teach it to recognize double-quoted tags, as well. Signed-off-by: Eric Sunshine Signed-off-by: Junio C Hamano diff --git a/t/chainlint.sed b/t/chainlint.sed index 8544df3..1da58b5 100644 --- a/t/chainlint.sed +++ b/t/chainlint.sed @@ -94,8 +94,8 @@ # here-doc -- swallow it to avoid false hits within its body (but keep the # command to which it was attached) -/<<[ ]*[-\\']*[A-Za-z0-9_]/ { - s/^\(.*\)<<[ ]*[-\\']*\([A-Za-z0-9_][A-Za-z0-9_]*\)'*/<\2>\1<\1<\1<\1<foo && cat >bar && +cat >boo && + horticulture diff --git a/t/chainlint/here-doc.test b/t/chainlint/here-doc.test index f2bb14b..ad4ce8a 100644 --- a/t/chainlint/here-doc.test +++ b/t/chainlint/here-doc.test @@ -21,6 +21,13 @@ boz woz FUMP +# LINT: swallow "quoted" here-doc +cat <<"zump" >boo && +snoz +boz +woz +zump + # LINT: swallow here-doc (EOF is last line of test) horticulture <<\EOF gomez diff --git a/t/chainlint/subshell-here-doc.expect b/t/chainlint/subshell-here-doc.expect index 7663ea7..74723e7 100644 --- a/t/chainlint/subshell-here-doc.expect +++ b/t/chainlint/subshell-here-doc.expect @@ -6,5 +6,6 @@ ( cat >bup && cat >bup2 && + cat >bup3 && meep >) diff --git a/t/chainlint/subshell-here-doc.test b/t/chainlint/subshell-here-doc.test index b6b5a9b..f6b3ba4 100644 --- a/t/chainlint/subshell-here-doc.test +++ b/t/chainlint/subshell-here-doc.test @@ -31,5 +31,9 @@ glink FIZZ ARBITRARY2 + cat <<-"ARBITRARY3" >bup3 && + glink + FIZZ + ARBITRARY3 meep ) -- cgit v0.10.2-6-g49f6