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>

Attachment: signature.asc
Description: PGP signature

Reply via email to