Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shellcheck's directive for shell is not working #1139

Open
moonfruit opened this issue Apr 3, 2024 · 1 comment
Open

shellcheck's directive for shell is not working #1139

moonfruit opened this issue Apr 3, 2024 · 1 comment

Comments

@moonfruit
Copy link

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:

const args = [
`--shell=${shellName}`,
'--format=json1',
'--external-sources',
...sourcePathsArgs,
...additionalArgs,
]

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
Copy link
Author

See koalaman/shellcheck#2971

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant