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 <sunshine@sunshineco.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Eric Sunshine committed
Nov 8, 2022 at 19:08 UTC
c90d81f8bb691b6627497e69d599e1f7fa7e9dfa
1 file changed
+4
t/chainlint.pl
+4
@@ -505,7 +505,11 @@ my @safe_endings = (
505
506
sub accumulate {
507
my ($self, $tokens, $cmd) = @_;
508
+
509
+ # no previous command to check for missing "&&"
510
goto DONE unless @$tokens;
511
+
512
+ # new command is empty line; can't yet check if previous is missing "&&"
513
goto DONE if @$cmd == 1 && $$cmd[0] eq "\n";
514
515
# did previous command end with "&&", "|", "|| return" or similar?