[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ShellCheck reports error in run_parser_all.sh (patch)
From: |
Vitezslav Crhonek |
Subject: |
Re: ShellCheck reports error in run_parser_all.sh (patch) |
Date: |
Wed, 17 Feb 2021 08:10:04 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 |
On 2/16/21 5:00 PM, Gavin Smith wrote:
> On Tue, Feb 16, 2021 at 10:30:44AM +0100, Vitezslav Crhonek wrote:
>> Hi,
>>
>> ShellCheck reports error [1] in tp/tests/run_parser_all.sh script.
>> 'continue' is used there to exit a function.
>>
>> I don't consider it to be a big deal but it would be nice to have it
>> fixed at least for the sake of clean code. Simple patch attached.
>>
>> The issue has been originally reported by yeah_wang at [2].
>
> I think the code was originally supposed to continue a loop in
> the code that that calls the function. I think changing it to
> "return 1" would be the sensible change to make sure this happens:
> nothing special happens if 2 is returned instead.
Yes, I see. I didn't check whether the function is used elsewhere and
it would be useful to return different error codes for different kind
of errors. 'return 1' is fine too then.
>
>>
>> Best regards
>> Vita
>>
>> [1] https://github.com/koalaman/shellcheck/wiki/SC2104
>> [2] https://bugzilla.redhat.com/show_bug.cgi?id=1921666
>>
>> --
>> Vitezslav Crhonek
>> Software Engineer
>> Red Hat
>
>> diff --git a/tp/tests/run_parser_all.sh b/tp/tests/run_parser_all.sh
>> index f424bbb421..8069d466f6 100755
>> --- a/tp/tests/run_parser_all.sh
>> +++ b/tp/tests/run_parser_all.sh
>> @@ -46,7 +46,7 @@ check_latex2html_and_tex4ht ()
>> if echo "$remaining" | grep '[-]init mediawiki.pm' >/dev/null; then
>> if test "$no_html2wiki" = 'yes' ; then
>> echo "S: (no html2wiki) $current"
>> - continue 2
>> + return 2
>> fi
>> fi
>> fi
>
--
Vitezslav Crhonek
Software Engineer
Red Hat