Skip to content

Commit c90d81f

Browse files
sunshinecottaylorr
authored andcommitted
chainlint: add explanatory comments
The logic in TestParser::accumulate() for detecting broken &&-chains is mostly well-commented, but a couple branches which were deemed obvious and straightforward lack comments. In retrospect, though, these cases may give future readers pause, so comment them, as well. Signed-off-by: Eric Sunshine <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent 3b08839 commit c90d81f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

t/chainlint.pl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,11 @@ sub parse_loop_body {
505505

506506
sub accumulate {
507507
my ($self, $tokens, $cmd) = @_;
508+
509+
# no previous command to check for missing "&&"
508510
goto DONE unless @$tokens;
511+
512+
# new command is empty line; can't yet check if previous is missing "&&"
509513
goto DONE if @$cmd == 1 && $$cmd[0] eq "\n";
510514

511515
# did previous command end with "&&", "|", "|| return" or similar?

0 commit comments

Comments
 (0)