From a1d88a4801ea2d439b34c3a41ff1ca130117de35 Mon Sep 17 00:00:00 2001 From: koalaman Date: Wed, 19 Aug 2015 18:43:35 -0700 Subject: [PATCH] Updated SC1090 (markdown) --- SC1090.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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