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: forcing to work with zsh does not work #1064

Open
chrisgrieser opened this issue Dec 7, 2023 · 2 comments · Fixed by #1133
Open

shellcheck: forcing to work with zsh does not work #1064

chrisgrieser opened this issue Dec 7, 2023 · 2 comments · Fixed by #1133

Comments

@chrisgrieser
Copy link
Contributor

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

@skovhus
Copy link
Collaborator

skovhus commented Mar 29, 2024

Contributions are more than welcome.

skovhus added a commit that referenced this issue Jan 2, 2025
fix: do not overwrite user-provided shellcheck `--shell` (#1064)
@skovhus skovhus reopened this Jan 3, 2025
@0xdevalias
Copy link

Context for the close/reopen:

skovhus Sorry to bother you again, but it seems this PR did not fix the issue.

The problem described in #1064 still occurs, and shellcheck does not become active in a zsh file, even if passing bashIde.shellcheckArguments = "--shell=bash". I assume the problem is that the LS somehow still does not enable shellcheck until it is a bash file?

Originally posted by @chrisgrieser in #1133 (comment)

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

Successfully merging a pull request may close this issue.

3 participants