Can't Follow Non-Constant Source. Use A Directive To Specify Location
Can't Follow Non-Constant Source. Use A Directive To Specify Location
SC1090
Edit New Page Jump to bottom
Problematic code:
. "$(find_install_dir)/lib.sh"
Correct code:
# shellcheck source=src/lib.sh
. "$(find_install_dir)/lib.sh"
Rationale:
ShellCheck is not able to include sourced files from paths that are determined at runtime.
The file will not be read, potentially resulting in warnings about unassigned variables and
similar.
Exceptions:
If you don't care that ShellCheck is unable to account for the file, specify # shellcheck
source=/dev/null .
shellcheck -P dir1:dir2/libs
Specify paths to search for sourced files, separated by : on Unix and ; on Windows.
Absolute paths will also be rooted in these.
https://github.com/koalaman/shellcheck/wiki/SC1090 1/2
5/12/2020 SC1090 · koalaman/shellcheck Wiki
The special path SCRIPTDIR can be used to specify searching the currently checked script's
directory, as in -P SCRIPTDIR or -P SCRIPTDIR/../libs . Subsequent -P flags
accumulate and take precedence.
Pages 365
ShellCheck
Installation
CentOS6
More Installation Guides
Usage
Directive
Ignore
Azure Pipelines
CircleCI
DevGuide
Integration
JUnit
Phabricator
TravisCI
GitLab CI
Severity
Template
Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature
above to find a specific one, or see Checks.
https://github.com/koalaman/shellcheck.wiki.git
https://github.com/koalaman/shellcheck/wiki/SC1090 2/2