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: files are not picked up correctly #35

Closed
roberth opened this issue Feb 6, 2020 · 9 comments
Closed

Shellcheck: files are not picked up correctly #35

roberth opened this issue Feb 6, 2020 · 9 comments

Comments

@roberth
Copy link
Contributor

roberth commented Feb 6, 2020

types: bash only finds #!/bin/bash shebangs it seems.

It should pick up:

  • *.sh
  • #!/bin/bash (this one seems to work)
  • #!/bin/sh
  • #!/usr/bin/env bash
  • #!/usr/bin/env sh
  • #!/usr/bin/env nix-shell+#!.*nix-shell.*-i bash.*
@domenkozar
Copy link
Member

This should probably be reported to https://github.com/pre-commit/pre-commit, since filtering isn't advanced enough to cover all these cases.

@blaggacao
Copy link
Contributor

blaggacao commented Sep 4, 2020

blaggacao pushed a commit to blaggacao/pre-commit-hooks.nix that referenced this issue Sep 4, 2020
@blaggacao blaggacao mentioned this issue Sep 4, 2020
blaggacao pushed a commit to blaggacao/identify that referenced this issue Sep 4, 2020
@blaggacao
Copy link
Contributor

blaggacao commented Sep 4, 2020

Please review & approve there: pre-commit/identify#130

After those changes, the #!.*nix-shell.*-i bash.* unconventional format would not be supported by identify, yet. But maybe there is an argument for supporting it cleanly to be made upstream.

@blaggacao
Copy link
Contributor

Yoou! Looks like striking this ticket off the list comes within reach 🥳

@asottile
Copy link

asottile commented Sep 5, 2020

OP's message implies this is using types: [bash] -- you probably want types: [shell] fwiw

@blaggacao
Copy link
Contributor

@asottile

OP's message implies this is using types: [bash] -- you probably want types: [shell] fwiw

Oh thank you! Actually the following commit was meant not to hit on eg. csh which is not supported by shellcheck. I can already update the corresponding draft PR here. Is there a possibility to cut a release for identify soonish?

pre-commit/identify#129

@asottile
Copy link

asottile commented Sep 5, 2020

I was going to merge the nix stuff first

@roberth
Copy link
Contributor Author

roberth commented Sep 5, 2020

@roberth
Copy link
Contributor Author

roberth commented Aug 31, 2021

Encountered this just now. Not sure if everything is up to date, but I suppose this may help others. My error:

In scripts/generate-nix line 1:
#!/usr/bin/env nix-shell
^-- SC1008: This shebang was unrecognized. ShellCheck only supports sh/bash/dash/ksh. Add a 'shell' directive to specify.

Successful workaround:

#!/usr/bin/env nix-shell
# shellcheck shell=bash
#!nix-shell -i bash
#!nix-shell ../shell.nix

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

4 participants