-
Notifications
You must be signed in to change notification settings - Fork 493
SC1090 can't be satisfied -- it wants shellcheck directives (which are shell comments) #343
Copy link
Copy link
Closed
Description
- This is a bug report
- This is a feature request
- I searched existing issues before opening this one
Minimal example
Consider this mini.Dockerfile
FROM alpine:3
SHELL ["/bin/bash", "-c"]
ENV NVM_DIR=/usr/local/nvm
RUN source $NVM_DIR/nvm.shLinting fails:
$ docker run --rm -i hadolint/hadolint:latest /bin/hadolint - < mini.Dockerfile
/dev/stdin:4 SC1090 Can't follow non-constant source. Use a directive to specify location.What does shellcheck say?
According to https://github.com/koalaman/shellcheck/wiki/SC1090 the fix is to put a shell comment "directive" to assist:
# shellcheck source=src/lib.sh
. "$(find_install_dir)/lib.sh"If you don't care that ShellCheck is unable to account for the file, specify
# shellcheck source=/dev/null.
But that doesn't work...
mini2.Dockerfile
FROM alpine:3
SHELL ["/bin/bash", "-c"]
ENV NVM_DIR=/usr/local/nvm
RUN # shellcheck source=/dev/null
RUN source $NVM_DIR/nvm.sh$ docker run --rm -i hadolint/hadolint:latest /bin/hadolint - < mini2.Dockerfile
/dev/stdin:4 SC1072 Expected a command. Fix any mentioned problems and try again.
/dev/stdin:5 SC1090 Can't follow non-constant source. Use a directive to specify location.The old "Now you have 2 problems"...
mini3.Dockerfile
FROM alpine:3
SHELL ["/bin/bash", "-c"]
ENV NVM_DIR=/usr/local/nvm
# shellcheck source=/dev/null
RUN source $NVM_DIR/nvm.sh$ docker run --rm -i hadolint/hadolint:latest /bin/hadolint - < mini3.Dockerfile
/dev/stdin:5 SC1090 Can't follow non-constant source. Use a directive to specify location.Expected behavior
Either drop the error entirely or provide a valid way to work around it.
Version
Output of hadolint --version or
docker run --rm hadolint/hadolint hadolint --version:
$ docker run --rm hadolint/hadolint:latest hadolint --version
Haskell Dockerfile Linter v1.17.0-0-g56fd3e1Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels