shellcheck icon indicating copy to clipboard operation
shellcheck copied to clipboard

SC2148, direnv and .envrc

Open adamtulinius opened this issue 11 months ago • 0 comments

Shellcheck fails with error SC2148 on .envrc files (missing shebang).

However, .envrc-files are https://github.com/direnv/direnv files, and according to the documentation these are always passed through bash (https://github.com/direnv/direnv?tab=readme-ov-file#how-it-works). It seems like shellcheck should always parse these files as bash, instead of having users add a shebang line only for the sake of shellcheck.

Example .envrc:

if has nix; then
  use flake .
fi

I'm fine with trying to write a patch to fix this, but I would like some input on whether others also consider this a bug.

adamtulinius avatar May 07 '25 07:05 adamtulinius