Skip to content

Commit 5be30d0

Browse files
sunshinecogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0d71317 commit 5be30d0

39 files changed

+80
-89
lines changed

t/chainlint.sed

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@
7676
# newline, thus the closing here-doc tag has been found. The closing tag line
7777
# and the "<...>" prefix on the target line are then discarded, leaving just
7878
# the target line "cat >out".
79-
#
80-
# To facilitate regression testing (and manual debugging), a ">" annotation is
81-
# applied to the line containing ")" which closes a subshell, ">>" to a line
82-
# closing a nested subshell, and ">>>" to a line closing both at once. This
83-
# makes it easy to detect whether the heuristics correctly identify
84-
# end-of-subshell.
8579
#------------------------------------------------------------------------------
8680

8781
# incomplete line -- slurp up next line
@@ -337,7 +331,6 @@ n
337331
x
338332
bnstslrp
339333
:nstcl
340-
s/^/>>/
341334
# is it "))" which closes nested and parent subshells?
342335
/)[ ]*)/bslurp
343336
bchkchn
@@ -357,13 +350,11 @@ x
357350
s/\( ?!AMP?!\)* ?!AMP?!$//
358351
p
359352
x
360-
s/^/>/
361353
b
362354

363355
# found closing "...)" -- exit subshell loop
364356
:close
365357
x
366358
p
367359
x
368-
s/^/>/
369360
b

t/chainlint/arithmetic-expansion.expect

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
foo &&
33
bar=$((42 + 1)) &&
44
baz
5-
>) &&
5+
) &&
66
(
77
bar=$((42 + 1)) ?!AMP?!
88
baz
9-
>)
9+
)

t/chainlint/bash-array.expect

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
foo &&
33
bar=(gumbo stumbo wumbo) &&
44
baz
5-
>) &&
5+
) &&
66
(
77
foo &&
88
bar=${#bar[@]} &&
99
baz
10-
>)
10+
)

t/chainlint/blank-line.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
(
22
nothing &&
33
something
4-
>)
4+
)

t/chainlint/block.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
echo c
1010
} ?!AMP?!
1111
baz
12-
>)
12+
)

t/chainlint/broken-chain.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
bar ?!AMP?!
44
baz &&
55
wop
6-
>)
6+
)

t/chainlint/case.expect

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
*) bar ;;
55
esac &&
66
foobar
7-
>) &&
7+
) &&
88
(
99
case "$x" in
1010
x) foo ;;
1111
*) bar ;;
1212
esac ?!AMP?!
1313
foobar
14-
>) &&
14+
) &&
1515
(
1616
case "$x" in 1) true;; esac &&
1717
case "$y" in 2) false;; esac ?!AMP?!
1818
foobar
19-
>)
19+
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
(
22
cd foo &&
33
(bar &&
4-
>>> baz))
4+
baz))

t/chainlint/close-subshell.expect

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
(
22
foo
3-
>) &&
3+
) &&
44
(
55
bar
6-
>) >out &&
6+
) >out &&
77
(
88
baz
9-
>) 2>err &&
9+
) 2>err &&
1010
(
1111
boo
12-
>) <input &&
12+
) <input &&
1313
(
1414
bip
15-
>) | wuzzle &&
15+
) | wuzzle &&
1616
(
1717
bop
18-
>) | fazz fozz &&
18+
) | fazz fozz &&
1919
(
2020
bup
21-
>) |
21+
) |
2222
fuzzle &&
2323
(
2424
yop
25-
>)
25+
)

t/chainlint/command-substitution.expect

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
foo &&
33
bar=$(gobble) &&
44
baz
5-
>) &&
5+
) &&
66
(
77
bar=$(gobble blocks) ?!AMP?!
88
baz
9-
>)
9+
)

0 commit comments

Comments
 (0)