From db8c7a1cc02e545dd75b55e2ccbab2de51cd06ae Mon Sep 17 00:00:00 2001 From: Eric Sunshine Date: Mon, 13 Dec 2021 01:30:50 -0500 Subject: chainlint.sed: improve ?!AMP?! placement accuracy When chainlint.sed detects a broken &&-chain, it places an ?!AMP?! annotation at the beginning of the line. However, this is an unusual location for programmers accustomed to error messages (from compilers, for instance) indicating the exact point of the problem. Therefore, relocate the ?!AMP?! annotation to the end of the line in order to better direct the programmer's attention to the source of the problem. Signed-off-by: Eric Sunshine Signed-off-by: Junio C Hamano --- t/chainlint/for-loop.expect | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't/chainlint/for-loop.expect') diff --git a/t/chainlint/for-loop.expect b/t/chainlint/for-loop.expect index c33cf56ee7..dc209e21bd 100644 --- a/t/chainlint/for-loop.expect +++ b/t/chainlint/for-loop.expect @@ -1,9 +1,9 @@ ( for i in a b c do -?!AMP?! echo $i + echo $i ?!AMP?! cat -?!AMP?! done + done ?!AMP?! for i in a b c; do echo $i && cat $i -- cgit v1.2.3 From 5be30d0cd301f50e5f4dd992bc11ce75f457cf46 Mon Sep 17 00:00:00 2001 From: Eric Sunshine Date: Mon, 13 Dec 2021 01:30:54 -0500 Subject: chainlint.sed: drop subshell-closing ">" annotation chainlint.sed inserts a ">" annotation at the beginning of a line to signal that its heuristics have identified an end-of-subshell. This was useful as a debugging aid during development of the script, but it has no value to test writers and might even confuse them into thinking that the linter is misbehaving by inserting line-noise into the shell code it is validating. Moreover, its presence also potentially makes it difficult to reuse the chainlint self-test "expect" output should a more capable linter ever be developed. Therefore, drop the ">" annotation. Signed-off-by: Eric Sunshine Signed-off-by: Junio C Hamano --- t/chainlint/for-loop.expect | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/chainlint/for-loop.expect') diff --git a/t/chainlint/for-loop.expect b/t/chainlint/for-loop.expect index dc209e21bd..b74df064c5 100644 --- a/t/chainlint/for-loop.expect +++ b/t/chainlint/for-loop.expect @@ -8,4 +8,4 @@ echo $i && cat $i done ->) +) -- cgit v1.2.3 From 34ba05c2966f9e96b74ea984251e3bda802d6a7a Mon Sep 17 00:00:00 2001 From: Eric Sunshine Date: Mon, 13 Dec 2021 01:30:57 -0500 Subject: chainlint.sed: stop throwing away here-doc tags The purpose of chainlint is to highlight problems it finds in test code by inserting annotations at the location of each problem. Arbitrarily eliding bits of the code it is checking is not helpful, yet this is exactly what chainlint.sed does by cavalierly and unnecessarily dropping the here-doc operator and tag; i.e. `cat < Signed-off-by: Junio C Hamano --- t/chainlint/for-loop.expect | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/chainlint/for-loop.expect') diff --git a/t/chainlint/for-loop.expect b/t/chainlint/for-loop.expect index b74df064c5..6671b8cd84 100644 --- a/t/chainlint/for-loop.expect +++ b/t/chainlint/for-loop.expect @@ -2,7 +2,7 @@ for i in a b c do echo $i ?!AMP?! - cat + cat <<-EOF done ?!AMP?! for i in a b c; do echo $i && -- cgit v1.2.3