* [LTP] [RFC] Using shellcheck for shell make check
@ 2021-11-29 11:05 Petr Vorel
2021-11-29 11:54 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2021-11-29 11:05 UTC (permalink / raw)
To: Cyril Hrubis, Joerg Vehlow, Li Wang; +Cc: ltp
Hi,
checkbashisms does not detect all things: e.g. not catching {1..$FILE_COUNT}
[1]. Maybe we should reconsider using *also* shellcheck as Joerg suggested
(keep checkbashisms).
I don't like shellcheck output, but it can detects errors checkbashisms cannot
detect (checkbashisms is regexp based, but shellcheck IMHO evaluates the code).
Also it's configurable, thus ve could disable check we don't like or enable only
what we want to check. Or we can run just --severity=warning or
--severity=error. If you're not against it, I can have look into this.
Kind regards,
Petr
[1] https://lore.kernel.org/ltp/YZy5HNteJmoicTtJ@pevik/
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [RFC] Using shellcheck for shell make check
2021-11-29 11:05 [LTP] [RFC] Using shellcheck for shell make check Petr Vorel
@ 2021-11-29 11:54 ` Cyril Hrubis
2021-11-30 9:29 ` Richard Palethorpe
0 siblings, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2021-11-29 11:54 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
Hi!
> checkbashisms does not detect all things: e.g. not catching {1..$FILE_COUNT}
> [1]. Maybe we should reconsider using *also* shellcheck as Joerg suggested
> (keep checkbashisms).
>
> I don't like shellcheck output, but it can detects errors checkbashisms cannot
> detect (checkbashisms is regexp based, but shellcheck IMHO evaluates the code).
> Also it's configurable, thus ve could disable check we don't like or enable only
> what we want to check. Or we can run just --severity=warning or
> --severity=error. If you're not against it, I can have look into this.
Sounds good, the more automated checks we have the less we will spend on
review...
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [RFC] Using shellcheck for shell make check
2021-11-29 11:54 ` Cyril Hrubis
@ 2021-11-30 9:29 ` Richard Palethorpe
2021-11-30 10:01 ` Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: Richard Palethorpe @ 2021-11-30 9:29 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
Hello,
Cyril Hrubis <chrubis@suse.cz> writes:
> Hi!
>> checkbashisms does not detect all things: e.g. not catching {1..$FILE_COUNT}
>> [1]. Maybe we should reconsider using *also* shellcheck as Joerg suggested
>> (keep checkbashisms).
>>
>> I don't like shellcheck output, but it can detects errors checkbashisms cannot
>> detect (checkbashisms is regexp based, but shellcheck IMHO evaluates the code).
>> Also it's configurable, thus ve could disable check we don't like or enable only
>> what we want to check. Or we can run just --severity=warning or
>> --severity=error. If you're not against it, I can have look into this.
>
> Sounds good, the more automated checks we have the less we will spend on
> review...
We can't vendor in a Haskell program, so it will have to be an optional
check. Still it looks nice.
Tree-sitter also supports "Bash", which might be useful for LTP specific
checks. That ofcourse is much higher hanging fruit.
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [RFC] Using shellcheck for shell make check
2021-11-30 9:29 ` Richard Palethorpe
@ 2021-11-30 10:01 ` Petr Vorel
0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2021-11-30 10:01 UTC (permalink / raw)
To: Richard Palethorpe; +Cc: ltp
Hi Richie, Cyril,
> Hello,
> Cyril Hrubis <chrubis@suse.cz> writes:
> > Hi!
> >> checkbashisms does not detect all things: e.g. not catching {1..$FILE_COUNT}
> >> [1]. Maybe we should reconsider using *also* shellcheck as Joerg suggested
> >> (keep checkbashisms).
> >> I don't like shellcheck output, but it can detects errors checkbashisms cannot
> >> detect (checkbashisms is regexp based, but shellcheck IMHO evaluates the code).
> >> Also it's configurable, thus ve could disable check we don't like or enable only
> >> what we want to check. Or we can run just --severity=warning or
> >> --severity=error. If you're not against it, I can have look into this.
> > Sounds good, the more automated checks we have the less we will spend on
> > review...
> We can't vendor in a Haskell program, so it will have to be an optional
> check. Still it looks nice.
Yes, I didn't plan to vendor it. But fortunately it's being packaged some of
major distros [1] [2].
> Tree-sitter also supports "Bash", which might be useful for LTP specific
> checks. That ofcourse is much higher hanging fruit.
Interesting, it might be worth to investigate. But yes, the most important goal
is IMHO have valid portable POSIX syntax (to catch errors checkbashisms does not
detect).
I'd have to think about LTP specific checks (the only I would come up now is
LTP-003 - shell library API have TST_ prefix" but not sure how to test naming of
shell API as any shell global variables are local).
Kind regards,
Petr
[1] https://pkgs.org/download/ShellCheck
[2] https://pkgs.org/download/shellcheck
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-30 10:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-29 11:05 [LTP] [RFC] Using shellcheck for shell make check Petr Vorel
2021-11-29 11:54 ` Cyril Hrubis
2021-11-30 9:29 ` Richard Palethorpe
2021-11-30 10:01 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox