diff --git a/SC1090.md b/SC1090.md index c051404..20d98e0 100644 --- a/SC1090.md +++ b/SC1090.md @@ -1,20 +1,20 @@ -## This source will be skipped since it's not constant. +## Can't follow non-constant source. Use a directive to specify location. ### Problematic code: - source "$1/lib.sh" + . "$(find_install_dir)/lib.sh" ### Correct code: - # shellcheck disable=SC1090 - source "$1/lib.sh" + # shellcheck source=src/lib.sh + . "$(find_install_dir)/lib.sh" ### Rationale: -ShellCheck is not able to include sourced files from non-constant paths. +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. -Instead, be aware that anything in the sourced file will be ignored, and then disable the message. +Use a [[Directive]] to point shellcheck to a fixed location it can read instead. ### Exceptions: -Ignore the message with a [[directive]]. \ No newline at end of file +If you don't care that ShellCheck is unable to account for the file, specify `# shellcheck source=/dev/null`. \ No newline at end of file