git-commit-vandalism/t/chainlint
Eric Sunshine 31da22d1fd chainlint.sed: swallow comments consistently
When checking for broken a &&-chain, chainlint.sed knows that the final
statement in a subshell should not end with `&&`, so it takes care to
make a distinction between the final line which is an actual statement
and any lines which may be mere comments preceding the closing ')'. As
such, it swallows comment lines so that they do not interfere with the
&&-chain check.

However, since `sed` does not provide any sort of real recursion,
chainlint.sed only checks &&-chains in subshells one level deep; it
doesn't do any checking in deeper subshells or in `{...}` blocks within
subshells. Furthermore, on account of potential implementation
complexity, it doesn't check &&-chains within `case` arms.

Due to an oversight, it also doesn't swallow comments inside deep
subshells, `{...}` blocks, or `case` statements, which makes its output
inconsistent (swallowing comments in some cases but not others).
Unfortunately, this inconsistency seeps into the chainlint self-test
"expect" files, which potentially makes it difficult to reuse the
self-tests should a more capable chainlint ever be developed. Therefore,
teach chainlint.sed to consistently swallow comments in all cases.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-12-13 14:15:29 -08:00
..
arithmetic-expansion.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
arithmetic-expansion.test
bash-array.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
bash-array.test
blank-line.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
blank-line.test t/chainlint/*.test: generalize self-test commentary 2021-12-13 14:15:28 -08:00
block-comment.expect chainlint.sed: swallow comments consistently 2021-12-13 14:15:29 -08:00
block-comment.test chainlint.sed: swallow comments consistently 2021-12-13 14:15:29 -08:00
block.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
block.test t/chainlint/*.test: generalize self-test commentary 2021-12-13 14:15:28 -08:00
broken-chain.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
broken-chain.test
case-comment.expect chainlint.sed: swallow comments consistently 2021-12-13 14:15:29 -08:00
case-comment.test chainlint.sed: swallow comments consistently 2021-12-13 14:15:29 -08:00
case.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
case.test
close-nested-and-parent-together.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
close-nested-and-parent-together.test
close-subshell.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
close-subshell.test
command-substitution.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
command-substitution.test
comment.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
comment.test
complex-if-in-cuddled-loop.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
complex-if-in-cuddled-loop.test
cuddled-if-then-else.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
cuddled-if-then-else.test
cuddled-loop.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
cuddled-loop.test
cuddled.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
cuddled.test t/chainlint/*.test: generalize self-test commentary 2021-12-13 14:15:28 -08:00
exit-loop.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
exit-loop.test
exit-subshell.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
exit-subshell.test
for-loop.expect chainlint.sed: stop throwing away here-doc tags 2021-12-13 14:15:29 -08:00
for-loop.test
here-doc-close-subshell.expect chainlint.sed: stop throwing away here-doc tags 2021-12-13 14:15:29 -08:00
here-doc-close-subshell.test
here-doc-multi-line-command-subst.expect chainlint.sed: stop throwing away here-doc tags 2021-12-13 14:15:29 -08:00
here-doc-multi-line-command-subst.test
here-doc-multi-line-string.expect chainlint.sed: stop throwing away here-doc tags 2021-12-13 14:15:29 -08:00
here-doc-multi-line-string.test
here-doc.expect chainlint.sed: stop throwing away here-doc tags 2021-12-13 14:15:29 -08:00
here-doc.test
if-in-loop.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
if-in-loop.test
if-then-else.expect chainlint.sed: stop throwing away here-doc tags 2021-12-13 14:15:29 -08:00
if-then-else.test
incomplete-line.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
incomplete-line.test
inline-comment.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
inline-comment.test
loop-in-if.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
loop-in-if.test
multi-line-nested-command-substitution.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
multi-line-nested-command-substitution.test
multi-line-string.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
multi-line-string.test
negated-one-liner.expect chainlint.sed: drop unnecessary distinction between ?!AMP?! and ?!SEMI?! 2021-12-13 14:15:29 -08:00
negated-one-liner.test
nested-cuddled-subshell.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
nested-cuddled-subshell.test
nested-here-doc.expect chainlint.sed: stop throwing away here-doc tags 2021-12-13 14:15:29 -08:00
nested-here-doc.test
nested-subshell-comment.expect chainlint.sed: swallow comments consistently 2021-12-13 14:15:29 -08:00
nested-subshell-comment.test
nested-subshell.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
nested-subshell.test t/chainlint/*.test: generalize self-test commentary 2021-12-13 14:15:28 -08:00
not-heredoc.expect chainlint.sed: don't mistake << word in string as here-doc operator 2021-12-13 14:15:29 -08:00
not-heredoc.test chainlint.sed: don't mistake << word in string as here-doc operator 2021-12-13 14:15:29 -08:00
one-liner.expect chainlint.sed: drop unnecessary distinction between ?!AMP?! and ?!SEMI?! 2021-12-13 14:15:29 -08:00
one-liner.test t/chainlint/one-liner: avoid overly intimate chainlint.sed knowledge 2021-12-13 14:15:28 -08:00
p4-filespec.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
p4-filespec.test
pipe.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
pipe.test
semicolon.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
semicolon.test t/chainlint/*.test: generalize self-test commentary 2021-12-13 14:15:28 -08:00
subshell-here-doc.expect chainlint.sed: stop throwing away here-doc tags 2021-12-13 14:15:29 -08:00
subshell-here-doc.test
subshell-one-liner.expect chainlint.sed: drop subshell-closing ">" annotation 2021-12-13 14:15:29 -08:00
subshell-one-liner.test
t7900-subtree.expect chainlint.sed: stop throwing away here-doc tags 2021-12-13 14:15:29 -08:00
t7900-subtree.test
while-loop.expect chainlint.sed: stop throwing away here-doc tags 2021-12-13 14:15:29 -08:00
while-loop.test