mirror of
https://github.com/git/git.git
synced 2024-11-28 04:23:30 +08:00
chainlint: match 'quoted' here-doc tags
A here-doc tag can be quoted ('EOF') or escaped (\EOF) to suppress interpolation within the body. Although, chainlint recognizes escaped tags, it does not know about quoted tags. For completeness, teach it to recognize quoted tags, as well. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
c2c29cc03e
commit
7e32a31b21
@ -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<</
|
||||
/<<[ ]*[-\\']*[A-Za-z0-9_]/ {
|
||||
s/^\(.*\)<<[ ]*[-\\']*\([A-Za-z0-9_][A-Za-z0-9_]*\)'*/<\2>\1<</
|
||||
s/[ ]*<<//
|
||||
:hereslurp
|
||||
N
|
||||
@ -158,7 +158,7 @@ s/.*\n//
|
||||
/"[^'"]*'[^'"]*"/!bsqstring
|
||||
}
|
||||
# here-doc -- swallow it
|
||||
/<<[ ]*[-\\]*[A-Za-z0-9_]/bheredoc
|
||||
/<<[ ]*[-\\']*[A-Za-z0-9_]/bheredoc
|
||||
# comment or empty line -- discard since final non-comment, non-empty line
|
||||
# before closing ")", "done", "elsif", "else", or "fi" will need to be
|
||||
# re-visited to drop "suspect" marking since final line of those constructs
|
||||
@ -268,7 +268,7 @@ bcheckchain
|
||||
# found here-doc -- swallow it to avoid false hits within its body (but keep
|
||||
# the command to which it was attached)
|
||||
:heredoc
|
||||
s/^\(.*\)<<[ ]*[-\\]*\([A-Za-z0-9_][A-Za-z0-9_]*\)/<\2>\1<</
|
||||
s/^\(.*\)<<[ ]*[-\\']*\([A-Za-z0-9_][A-Za-z0-9_]*\)'*/<\2>\1<</
|
||||
s/[ ]*<<//
|
||||
:hereslurpsub
|
||||
N
|
||||
|
@ -2,4 +2,6 @@ boodle wobba gorgo snoot wafta snurb &&
|
||||
|
||||
cat >foo &&
|
||||
|
||||
cat >bar &&
|
||||
|
||||
horticulture
|
||||
|
@ -14,6 +14,13 @@ boz
|
||||
woz
|
||||
Arbitrary_Tag_42
|
||||
|
||||
# LINT: swallow 'quoted' here-doc
|
||||
cat <<'FUMP' >bar &&
|
||||
snoz
|
||||
boz
|
||||
woz
|
||||
FUMP
|
||||
|
||||
# LINT: swallow here-doc (EOF is last line of test)
|
||||
horticulture <<\EOF
|
||||
gomez
|
||||
|
@ -5,5 +5,6 @@
|
||||
>) &&
|
||||
(
|
||||
cat >bup &&
|
||||
cat >bup2 &&
|
||||
meep
|
||||
>)
|
||||
|
@ -27,5 +27,9 @@
|
||||
glink
|
||||
FIZZ
|
||||
ARBITRARY
|
||||
cat <<-'ARBITRARY2' >bup2 &&
|
||||
glink
|
||||
FIZZ
|
||||
ARBITRARY2
|
||||
meep
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user