mbox series

[libgpiod,0/8] tools: tests: fix shellcheck warnings

Message ID 20240531134512.443850-1-warthog618@gmail.com
Headers show
Series tools: tests: fix shellcheck warnings | expand

Message

Kent Gibson May 31, 2024, 1:45 p.m. UTC
Following up on recent discussions, this series fixes all the warnings
detected by shellcheck.  The resulting tools test script is now clean,
at least from the perspective of shellcheck.

These fixes do not correct any known issue, other than shellcheck
reporting them as potential problems, the intent is to remove common
shell issues that may impact future changes, and to simplify checking
that any subsequent changes to the test script constitute "good" shell.

All the patches other than Patch 8 address a particular warning.
They are reasonably self-explanatory, but each commit comment includes a
link to the relevant warning(s) which describes the issue and the
appropriate corrections.

Patch 8 addresses a number of warnings, all related to word splitting
and globbing, and those constitute the bulk of the changes.
Some of the earlier patches also address trivial splitting/globbing
issues where that would prevent a line being modified multiple times.

Cheers,
Kent.

Kent Gibson (8):
  tools: tests: don't mix string and array
  tools: tests: don't declare and assign separately
  tools: tests: fix unused variables
  tools: tests: use read -r to avoid mangling backslashes
  tools: tests: don't use variables in printf format string
  tools: tests: check exit code directly
  tools: tests: shellcheck don't follow sourced file
  tools: tests: avoid splitting and globbing

 tools/gpio-tools-test.bash | 459 +++++++++++++++++++------------------
 1 file changed, 234 insertions(+), 225 deletions(-)

--
2.39.2

Comments

Bartosz Golaszewski June 3, 2024, 10:40 a.m. UTC | #1
On Fri, May 31, 2024 at 3:45 PM Kent Gibson <warthog618@gmail.com> wrote:
>
> Following up on recent discussions, this series fixes all the warnings
> detected by shellcheck.  The resulting tools test script is now clean,
> at least from the perspective of shellcheck.
>
> These fixes do not correct any known issue, other than shellcheck
> reporting them as potential problems, the intent is to remove common
> shell issues that may impact future changes, and to simplify checking
> that any subsequent changes to the test script constitute "good" shell.
>
> All the patches other than Patch 8 address a particular warning.
> They are reasonably self-explanatory, but each commit comment includes a
> link to the relevant warning(s) which describes the issue and the
> appropriate corrections.
>
> Patch 8 addresses a number of warnings, all related to word splitting
> and globbing, and those constitute the bulk of the changes.
> Some of the earlier patches also address trivial splitting/globbing
> issues where that would prevent a line being modified multiple times.
>
> Cheers,
> Kent.
>
> Kent Gibson (8):
>   tools: tests: don't mix string and array
>   tools: tests: don't declare and assign separately
>   tools: tests: fix unused variables
>   tools: tests: use read -r to avoid mangling backslashes
>   tools: tests: don't use variables in printf format string
>   tools: tests: check exit code directly
>   tools: tests: shellcheck don't follow sourced file
>   tools: tests: avoid splitting and globbing
>
>  tools/gpio-tools-test.bash | 459 +++++++++++++++++++------------------
>  1 file changed, 234 insertions(+), 225 deletions(-)
>
> --
> 2.39.2
>

Ugh, you added links after the SoB and it messes up with b4. Can you
resend it with links before any tags? Or better yet: make [x] into
Link: [x] so that b4 can interpret it correctly?

Thanks
Bart
Kent Gibson June 3, 2024, 10:43 a.m. UTC | #2
On Mon, Jun 03, 2024 at 12:40:37PM +0200, Bartosz Golaszewski wrote:
> On Fri, May 31, 2024 at 3:45 PM Kent Gibson <warthog618@gmail.com> wrote:
> >
> > Following up on recent discussions, this series fixes all the warnings
> > detected by shellcheck.  The resulting tools test script is now clean,
> > at least from the perspective of shellcheck.
> >
> > These fixes do not correct any known issue, other than shellcheck
> > reporting them as potential problems, the intent is to remove common
> > shell issues that may impact future changes, and to simplify checking
> > that any subsequent changes to the test script constitute "good" shell.
> >
> > All the patches other than Patch 8 address a particular warning.
> > They are reasonably self-explanatory, but each commit comment includes a
> > link to the relevant warning(s) which describes the issue and the
> > appropriate corrections.
> >
> > Patch 8 addresses a number of warnings, all related to word splitting
> > and globbing, and those constitute the bulk of the changes.
> > Some of the earlier patches also address trivial splitting/globbing
> > issues where that would prevent a line being modified multiple times.
> >
> > Cheers,
> > Kent.
> >
> > Kent Gibson (8):
> >   tools: tests: don't mix string and array
> >   tools: tests: don't declare and assign separately
> >   tools: tests: fix unused variables
> >   tools: tests: use read -r to avoid mangling backslashes
> >   tools: tests: don't use variables in printf format string
> >   tools: tests: check exit code directly
> >   tools: tests: shellcheck don't follow sourced file
> >   tools: tests: avoid splitting and globbing
> >
> >  tools/gpio-tools-test.bash | 459 +++++++++++++++++++------------------
> >  1 file changed, 234 insertions(+), 225 deletions(-)
> >
> > --
> > 2.39.2
> >
>
> Ugh, you added links after the SoB and it messes up with b4. Can you
> resend it with links before any tags? Or better yet: make [x] into
> Link: [x] so that b4 can interpret it correctly?
>

hehe, yeah I wondered about that after I'd sent it.
I'll fix for v2.

Cheers,
Kent.
Kent Gibson June 3, 2024, 10:59 a.m. UTC | #3
On Mon, Jun 03, 2024 at 06:43:08PM +0800, Kent Gibson wrote:
> On Mon, Jun 03, 2024 at 12:40:37PM +0200, Bartosz Golaszewski wrote:
> > On Fri, May 31, 2024 at 3:45 PM Kent Gibson <warthog618@gmail.com> wrote:
> > >
> > > Following up on recent discussions, this series fixes all the warnings
> > > detected by shellcheck.  The resulting tools test script is now clean,
> > > at least from the perspective of shellcheck.
> > >
> > > These fixes do not correct any known issue, other than shellcheck
> > > reporting them as potential problems, the intent is to remove common
> > > shell issues that may impact future changes, and to simplify checking
> > > that any subsequent changes to the test script constitute "good" shell.
> > >
> > > All the patches other than Patch 8 address a particular warning.
> > > They are reasonably self-explanatory, but each commit comment includes a
> > > link to the relevant warning(s) which describes the issue and the
> > > appropriate corrections.
> > >
> > > Patch 8 addresses a number of warnings, all related to word splitting
> > > and globbing, and those constitute the bulk of the changes.
> > > Some of the earlier patches also address trivial splitting/globbing
> > > issues where that would prevent a line being modified multiple times.
> > >
> > > Cheers,
> > > Kent.
> > >
> > > Kent Gibson (8):
> > >   tools: tests: don't mix string and array
> > >   tools: tests: don't declare and assign separately
> > >   tools: tests: fix unused variables
> > >   tools: tests: use read -r to avoid mangling backslashes
> > >   tools: tests: don't use variables in printf format string
> > >   tools: tests: check exit code directly
> > >   tools: tests: shellcheck don't follow sourced file
> > >   tools: tests: avoid splitting and globbing
> > >
> > >  tools/gpio-tools-test.bash | 459 +++++++++++++++++++------------------
> > >  1 file changed, 234 insertions(+), 225 deletions(-)
> > >
> > > --
> > > 2.39.2
> > >
> >
> > Ugh, you added links after the SoB and it messes up with b4. Can you
> > resend it with links before any tags? Or better yet: make [x] into
> > Link: [x] so that b4 can interpret it correctly?
> >
>
> hehe, yeah I wondered about that after I'd sent it.
> I'll fix for v2.
>

Can I confirm this is the format you want:

    Link: [1] https://www.shellcheck.net/wiki/SC2145

cos that makes checkpatch.pl unhappy.

Thanks,
Kent.
Bartosz Golaszewski June 3, 2024, 11:51 a.m. UTC | #4
On Mon, Jun 3, 2024 at 12:59 PM Kent Gibson <warthog618@gmail.com> wrote:
>
> On Mon, Jun 03, 2024 at 06:43:08PM +0800, Kent Gibson wrote:
> > On Mon, Jun 03, 2024 at 12:40:37PM +0200, Bartosz Golaszewski wrote:
> > > On Fri, May 31, 2024 at 3:45 PM Kent Gibson <warthog618@gmail.com> wrote:
> > > >
> > > > Following up on recent discussions, this series fixes all the warnings
> > > > detected by shellcheck.  The resulting tools test script is now clean,
> > > > at least from the perspective of shellcheck.
> > > >
> > > > These fixes do not correct any known issue, other than shellcheck
> > > > reporting them as potential problems, the intent is to remove common
> > > > shell issues that may impact future changes, and to simplify checking
> > > > that any subsequent changes to the test script constitute "good" shell.
> > > >
> > > > All the patches other than Patch 8 address a particular warning.
> > > > They are reasonably self-explanatory, but each commit comment includes a
> > > > link to the relevant warning(s) which describes the issue and the
> > > > appropriate corrections.
> > > >
> > > > Patch 8 addresses a number of warnings, all related to word splitting
> > > > and globbing, and those constitute the bulk of the changes.
> > > > Some of the earlier patches also address trivial splitting/globbing
> > > > issues where that would prevent a line being modified multiple times.
> > > >
> > > > Cheers,
> > > > Kent.
> > > >
> > > > Kent Gibson (8):
> > > >   tools: tests: don't mix string and array
> > > >   tools: tests: don't declare and assign separately
> > > >   tools: tests: fix unused variables
> > > >   tools: tests: use read -r to avoid mangling backslashes
> > > >   tools: tests: don't use variables in printf format string
> > > >   tools: tests: check exit code directly
> > > >   tools: tests: shellcheck don't follow sourced file
> > > >   tools: tests: avoid splitting and globbing
> > > >
> > > >  tools/gpio-tools-test.bash | 459 +++++++++++++++++++------------------
> > > >  1 file changed, 234 insertions(+), 225 deletions(-)
> > > >
> > > > --
> > > > 2.39.2
> > > >
> > >
> > > Ugh, you added links after the SoB and it messes up with b4. Can you
> > > resend it with links before any tags? Or better yet: make [x] into
> > > Link: [x] so that b4 can interpret it correctly?
> > >
> >
> > hehe, yeah I wondered about that after I'd sent it.
> > I'll fix for v2.
> >
>
> Can I confirm this is the format you want:
>
>     Link: [1] https://www.shellcheck.net/wiki/SC2145
>
> cos that makes checkpatch.pl unhappy.
>
> Thanks,
> Kent.

Ok then make it:

[1] ...
[2] ...

Signed-off-by: ...
Konstantin Ryabitsev June 3, 2024, 2:59 p.m. UTC | #5
On Mon, Jun 03, 2024 at 06:59:14PM GMT, Kent Gibson wrote:
> Can I confirm this is the format you want:
> 
>     Link: [1] https://www.shellcheck.net/wiki/SC2145
> 
> cos that makes checkpatch.pl unhappy.

I suggest you use:

    | Link: https://www.shellcheck.net/wiki/SC2145 # [1]

This would make most tooling happy.

-K