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

shellcheck: forcing to work with zsh does not work

Open chrisgrieser opened this issue 1 year ago • 1 comments

Code editor

nvim

Platform

macOS 14.1 (arm)

Version

5.0.0

What steps will reproduce the bug?

shell file with zsh shebang and an issue that shellcheck will reprot:

#!/usr/bin/env bash
cat foo | grep "foobar"
# here shellcheck reports an issue
#!/usr/bin/env zsh
cat foo | grep "foobar"
# here it does not

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

always

What is the expected behavior?

When using shellcheck, you can actually force it to check zsh files by adding --shell=bash. While not perfect, it's still useful.

However, when passing bashIde.shellcheckArguments = "--shell=bash", bashls still refuses to lint files with a zsh shebang. I assume there is something in the bashls source-code which stops shellcheck from working on zsh files, even if it nromally works in shellcheck.

What do you see instead?

shellcheck not working as soon as you add a zsh-shebang

Additional information

  • related issue: #929
  • potential cause? #536

chrisgrieser avatar Dec 07 '23 16:12 chrisgrieser

Contributions are more than welcome.

skovhus avatar Mar 29 '24 20:03 skovhus