bash-language-server icon indicating copy to clipboard operation
bash-language-server copied to clipboard

shellcheck's directive for shell is not working

Open moonfruit opened this issue 1 year ago • 1 comments

Code editor

Any

Platform

Any

Version

5.1.2

What steps will reproduce the bug?

bash-language-server makes shellcheck's directive for shell not working because of this:

https://github.com/bash-lsp/bash-language-server/blob/39abef9fab6172676c5b8d53b7de30aaa2f3c576/server/src/shellcheck/index.ts#L122-L128

For example, shellcheck will not report any errors for this script:

#!/bin/sh
# shellcheck shell=bash
echo -e "test"

But shellcheck --shell test.sh will produce:

$ shellcheck --shell sh test.sh
In test.sh line 3:
echo -e "test"
     ^-- SC3037 (warning): In POSIX sh, echo flags are undefined.

For more information:
  https://www.shellcheck.net/wiki/SC3037 -- In POSIX sh, echo flags are undef...

How often does it reproduce? Is there a required condition?

Every time.

What is the expected behavior?

shellcheck's directive for shell will work fine, whether it's defined in .shellcheckrc or in a script.

What do you see instead?

shellcheck's directive for shell is not working.

Additional information

No response

moonfruit avatar Apr 03 '24 05:04 moonfruit

See koalaman/shellcheck#2971

moonfruit avatar Apr 25 '24 01:04 moonfruit