Re: [PATCH 5/8] Avoid shellcheck warning
Alejandro Colomar via Mutt-dev <[email protected]>
| Newsgroups | gmane.mail.mutt.devel |
|---|---|
| Message-ID | <aZ2md6JZIuXtlyH0@devuan> |
Hi Rene, On 2026-02-24T14:10:36+0100, Rene Kita wrote: > shellcheck warns: > Avoid x-prefix in comparisons as it no longer serves a purpose. > > While this is true, it also does not really harm - besides some > arguments about readability. As zsh fixed this only ~11 years ago, let's > keep it for some years but silence shellcheck. > --- > contrib/bgedit-screen-tmux.sh | 2 ++ > version.sh | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/contrib/bgedit-screen-tmux.sh b/contrib/bgedit-screen-tmux.sh > index 9ab71157..4c1208e4 100644 > --- a/contrib/bgedit-screen-tmux.sh > +++ b/contrib/bgedit-screen-tmux.sh > @@ -52,6 +52,8 @@ $editor "\$@" > exitval=\$? > END_SCRIPT > > +# SC2268 (style): Avoid x-prefix in comparisons as it no longer serves a purpose. > +# shellcheck disable=SC2268 I expect we want to disable this globally. To avoid noise in the source code, should we maybe have a shellcheckrc file disabling this? In the Linux man-pages project, I run shellcheck(1) as part of the build system. It's ran by `make lint-sh-shellcheck`. That target uses a config file we have in the repo, as "etc/shellcheck/shellcheckrc". <https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/etc/shellcheck/shellcheckrc> The make(1) lint-sh-shellcheck target is specified here: <https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/share/mk/lint/sh/shellcheck.mk> and the shellcheck(1) flags for the makefile are configured here: <https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/share/mk/configure/build-depends/shellcheck/shellcheck.mk> Have a lovely day! Alex > if test x"$STY" != x; then > screen -X screen /bin/sh "$tmpdir/run" "$@" > elif test x"$TMUX" != x; then > diff --git a/version.sh b/version.sh > index 6abdcc0c..6946cfd5 100644 > --- a/version.sh > +++ b/version.sh > @@ -15,6 +15,8 @@ version=$(echo "$latesttag" | sed -e s/mutt-// -e s/-rel// -e s/-/./g) > distance=$(git rev-list --count "$latesttag"..) > commitid=$(git rev-parse --short HEAD) > > +# SC2268 (style): Avoid x-prefix in comparisons as it no longer serves a purpose. > +# shellcheck disable=SC2268 > [ x = "x$distance" ] && exec cat VERSION > > if [ 0 -eq "$distance" ]; then > -- > 2.51.0 > -- <https://www.alejandro-colomar.es>
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmmdp3QACgkQ64mZXMKQ wqkhvhAAu2K+gkrVT2ofCWWCOoCO5XnAaUZlCFJC2NVJ1bboNZ/4ASxxbxS2m66M jPzavz4GEGvz+maWtD97UJLidZToS/YY6VKkoy8XkF2IWSJVT8KzxXUJqH3tRF7I moYdn4624BaWcr2ezuonj6DYNqBZdp/YJ6ysfAzi361IkCyGVkcxNnX11BosIh/c jJE/8gL16VClUwzW/NuaYdly8t6P6rnAl+MMNoOU5XwnowXqGoNusqaknDFoTncs fjnZJLoEmcYkj2fQ7KybLDT24hrqncYHOgkfSlQNQLCKHMZY2qA+D1OnNGyTGRKb NvxHkJaVGNFVWhXBXfaC71Eh1yOO/JJmZMGM2+fpvd99qnDeKNUfU8b8LvaRQ8KA KrL8QbWt8NZnc0Pa5knF03nCEYieK6xKfUQsRCMFNJZKN5qmH5xRiiWvrDS7fOdg 4g1LkA7u+yqXS7j7dZkHvDsxBahmIW8NPHBao8hzeVEs6eyJt2j3YiOUYZzQ0O0Q 7RKkMTySUvkO5Slk9bT/1SRWy34WwzrylgBSxtRNUbqwOGuBBph04Uzpuhmiag71 3XwTRiuCaf020qPlgDldeTKFJUAxYSGMr6jdaVREV46HhOgoCxxjz5LC6vlNMOe2 vUkid6VBOO/KxAn69+K60yYGDNI9yJW8F6l6M7HMdG6LEPS8lyc= =kkev -----END PGP SIGNATURE-----