diff --git a/.circleci/config.yml b/.circleci/config.yml index afe0690..00119b3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ version: 2.1 jobs: build: machine: - image: ubuntu-2004:202201-02 + image: default steps: - checkout - run: diff --git a/core/modules/args/hooks/init/init.source.sh b/core/modules/args/hooks/init/init.source.sh index 354664b..65c574f 100755 --- a/core/modules/args/hooks/init/init.source.sh +++ b/core/modules/args/hooks/init/init.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash + # Gets the value of a script parameter, where --parameter=value. # # 1 will be returned if --parameter was passed without a value; @@ -7,6 +9,7 @@ # @param $1 # The name of parameter. function argvalue() { + # shellcheck disable=SC2154 source "$GlobalSCRIPTDIR"/core/modules/args/scripts/arg-value.source.sh "$1" if [ -z "$ARGVALUE" ]; then echo 0 diff --git a/core/modules/args/scripts/arg-value.source.sh b/core/modules/args/scripts/arg-value.source.sh index d37aba2..1725f28 100755 --- a/core/modules/args/scripts/arg-value.source.sh +++ b/core/modules/args/scripts/arg-value.source.sh @@ -1,8 +1,11 @@ +#!/bin/bash + # Available arguments # * $PARAMS, an array of params like 'a=b', 'c=d' - +# shellcheck disable=SC2154 for i in "${GlobalPARAMS[@]}" do + # shellcheck disable=SC2154 source "$GlobalSCRIPTDIR"/core/modules/args/scripts/parse-param.source.sh "$i" if [ "$NAME" == "$1" ]; then ARGVALUE="$VALUE" diff --git a/core/modules/args/scripts/parse-arguments.source.sh b/core/modules/args/scripts/parse-arguments.source.sh index 3057fbc..c79a017 100755 --- a/core/modules/args/scripts/parse-arguments.source.sh +++ b/core/modules/args/scripts/parse-arguments.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash + set -e # start by cycling through all arguments provided by the user. @@ -11,7 +13,8 @@ while [ $# -gt 0 ]; do UNVALIDATEDCOMMAND=$1 debug "Command is $COMMAND" else - GlobalARGS+=($1) + + GlobalARGS+=("$1") debug "$1 is an arg" fi fi @@ -21,5 +24,5 @@ done if [ -z "$UNVALIDATEDCOMMAND" ]; then UNVALIDATEDCOMMAND=help fi - +# shellcheck disable=SC2154 source "$GlobalSCRIPTDIR"/core/modules/args/scripts/validate-command.source.sh diff --git a/core/modules/args/scripts/parse-param.source.sh b/core/modules/args/scripts/parse-param.source.sh index ba950cc..31dfa19 100755 --- a/core/modules/args/scripts/parse-param.source.sh +++ b/core/modules/args/scripts/parse-param.source.sh @@ -1,8 +1,12 @@ +#!/bin/bash + ARG="$1" -NAME=$(sed 's/=.*$//g' <<< "$ARG") -NAME=$(sed 's/--//g' <<< "$NAME") -VALUE=$(sed 's/^--.*=//g' <<< "$ARG") +NAME="${ARG%%=*}" # Remove everything after the first '=' +NAME="${NAME//--/}" # Remove '--' from the name +VALUE="${ARG#*=}" # Extract the value after '=' +# If VALUE is empty, set it to 1 if [ -z "$VALUE" ]; then VALUE=1 fi + diff --git a/core/modules/args/scripts/run-command.source.sh b/core/modules/args/scripts/run-command.source.sh index 73b7918..71963c7 100755 --- a/core/modules/args/scripts/run-command.source.sh +++ b/core/modules/args/scripts/run-command.source.sh @@ -1,10 +1,13 @@ -# At this point $GlobalCOMMAND is valid so we can run it. +#!/bin/bash +# At this point $GlobalCOMMAND is valid so we can run it. +# shellcheck disable=SC2154 invoke-all "pre-command-$GlobalCOMMAND" - +# shellcheck disable=SC2154 if [ "$(ls "$GlobalSCRIPTDIR"/core/modules/*/commands/"$GlobalCOMMAND"/"$GlobalCOMMAND".source.sh 2>/dev/null)" ]; then for f in "$GlobalSCRIPTDIR"/core/modules/*/commands/"$GlobalCOMMAND"/"$GlobalCOMMAND".source.sh do + # shellcheck disable=SC1090 source "$f" done fi @@ -12,6 +15,7 @@ fi if [ "$(ls "$GlobalSCRIPTDIR"/script/modules/*/commands/"$GlobalCOMMAND"/"$GlobalCOMMAND".source.sh 2>/dev/null)" ]; then for f in "$GlobalSCRIPTDIR"/script/modules/*/commands/"$GlobalCOMMAND"/"$GlobalCOMMAND".source.sh do + # shellcheck disable=SC1090 source "$f" done fi diff --git a/core/modules/args/scripts/validate-command.source.sh b/core/modules/args/scripts/validate-command.source.sh index 37579ee..80b6708 100755 --- a/core/modules/args/scripts/validate-command.source.sh +++ b/core/modules/args/scripts/validate-command.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash +# shellcheck disable=SC2154 ls "$GlobalSCRIPTDIR"/core/modules/*/commands/"$UNVALIDATEDCOMMAND"/"$UNVALIDATEDCOMMAND".source.sh 2>/dev/null >/dev/null || ls "$GlobalSCRIPTDIR"/script/modules/*/commands/"$UNVALIDATEDCOMMAND"/"$UNVALIDATEDCOMMAND".source.sh 2>/dev/null >/dev/null || { echo -e "$GlobalSCRIPTNAME: Invalid command $UNVALIDATEDCOMMAND"; echo -e "See '$GlobalSCRIPTNAME usage' for available commands."; exit 1; } GlobalCOMMAND="$UNVALIDATEDCOMMAND" diff --git a/core/modules/core/hooks/init/init.source.sh b/core/modules/core/hooks/init/init.source.sh index a1ffb9b..540f155 100755 --- a/core/modules/core/hooks/init/init.source.sh +++ b/core/modules/core/hooks/init/init.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash + function uuid() { if [ -f /proc/sys/kernel/random/uuid ]; then LocalTEMPID=$(cat /proc/sys/kernel/random/uuid) diff --git a/core/modules/core/scripts/glob-exists.sh b/core/modules/core/scripts/glob-exists.sh index 2221b8c..690829b 100755 --- a/core/modules/core/scripts/glob-exists.sh +++ b/core/modules/core/scripts/glob-exists.sh @@ -1,3 +1,5 @@ +#!/bin/bash + # See https://github.com/koalaman/shellcheck/wiki/SC2144 set -e diff --git a/core/modules/core/scripts/uuid.sh b/core/modules/core/scripts/uuid.sh index 3300c72..fdaa45a 100755 --- a/core/modules/core/scripts/uuid.sh +++ b/core/modules/core/scripts/uuid.sh @@ -1,3 +1,5 @@ +#!/bin/bash + # Returns a unique string if [ -f /proc/sys/kernel/random/uuid ] diff --git a/core/modules/development/commands/self-test-list/self-test-list.source.sh b/core/modules/development/commands/self-test-list/self-test-list.source.sh index c857b2f..f9ef8ea 100755 --- a/core/modules/development/commands/self-test-list/self-test-list.source.sh +++ b/core/modules/development/commands/self-test-list/self-test-list.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash + for f in $(development_get_all_tests); do output list-element:"$f" 'info' "$f" done diff --git a/core/modules/development/commands/self-test/self-test.source.sh b/core/modules/development/commands/self-test/self-test.source.sh index 6daa593..0eb711b 100755 --- a/core/modules/development/commands/self-test/self-test.source.sh +++ b/core/modules/development/commands/self-test/self-test.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ALLTESTS=$(development_get_all_tests) for f in $ALLTESTS; do @@ -20,6 +22,7 @@ set -e SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd -P)" echo -e "[info] removing $SCRIPTDIR/tmp/test-data directory" +# shellcheck disable=SC2154 rm -rf "$GlobalSCRIPTDIR"/tmp/test-* echo -e '[info] linting' DOCKER=docker diff --git a/core/modules/development/hooks/end/end.source.sh b/core/modules/development/hooks/end/end.source.sh index 4e1ff6c..6612ebc 100755 --- a/core/modules/development/hooks/end/end.source.sh +++ b/core/modules/development/hooks/end/end.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash + if [ "$(argvalue debug)" == '1' ]; then echo -e "-----" echo -e "Printing full log because you set the --debug flag." diff --git a/core/modules/development/hooks/init/init.source.sh b/core/modules/development/hooks/init/init.source.sh index 2c7c534..5e4dd2c 100755 --- a/core/modules/development/hooks/init/init.source.sh +++ b/core/modules/development/hooks/init/init.source.sh @@ -1,4 +1,7 @@ +#!/bin/bash + function debug() { + # shellcheck disable=SC2154 source "$GlobalSCRIPTDIR"/core/modules/development/scripts/debug.source.sh "$1" } diff --git a/core/modules/development/scripts/debug.source.sh b/core/modules/development/scripts/debug.source.sh index 6db9ca4..6de18f1 100755 --- a/core/modules/development/scripts/debug.source.sh +++ b/core/modules/development/scripts/debug.source.sh @@ -1 +1,3 @@ +#!/bin/bash + LOG+=("[$2] $1") diff --git a/core/modules/development/scripts/lint.source.sh b/core/modules/development/scripts/lint.source.sh index 956f25d..6a77a8c 100644 --- a/core/modules/development/scripts/lint.source.sh +++ b/core/modules/development/scripts/lint.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash + echo '[info] About to get ShellCheck metrics' echo '[info] if you are getting a false negative put:' echo '[info] => # shellcheck disable=SC2016' @@ -8,4 +10,4 @@ echo '[info] => # shellcheck disable=SC2016' # shellcheck disable=SC2086 find . -name "*.sh" -print0 | \ - xargs -0 $DOCKER run --rm -v "$(pwd)":/code dcycle/shell-lint --exclude=SC2034 + xargs -0 $DOCKER run --rm -v "$(pwd)":/code dcycle/shell-lint:2 --exclude=SC2034 diff --git a/core/modules/extensibility/hooks/init/init.source.sh b/core/modules/extensibility/hooks/init/init.source.sh index d01694f..844f9a0 100755 --- a/core/modules/extensibility/hooks/init/init.source.sh +++ b/core/modules/extensibility/hooks/init/init.source.sh @@ -1,3 +1,6 @@ +#!/bin/bash + function invoke-all () { + # shellcheck disable=SC2154 source "$GlobalSCRIPTDIR/core/modules/extensibility/scripts/invoke-all.source.sh" "$1" } diff --git a/core/modules/extensibility/scripts/invoke-all.source.sh b/core/modules/extensibility/scripts/invoke-all.source.sh index e0f2a86..034ea7c 100755 --- a/core/modules/extensibility/scripts/invoke-all.source.sh +++ b/core/modules/extensibility/scripts/invoke-all.source.sh @@ -1,10 +1,14 @@ +#!/bin/bash + # Let modules respond to specific events like init, end, etc. +# shellcheck disable=SC2154 if ls "$GlobalSCRIPTDIR"/core/modules/*/hooks/"$1"/"$1".source.sh 1> /dev/null 2>&1; then for f in "$GlobalSCRIPTDIR"/core/modules/*/hooks/"$1"/"$1".source.sh do # Cannot call debug() here because invoke-all might be used before # functions are available. source "$GlobalSCRIPTDIR"/core/modules/development/scripts/debug.source.sh "About to call '$f'." 'full' + # shellcheck disable=SC1090 source "$f" done else @@ -17,6 +21,7 @@ if ls "$GlobalSCRIPTDIR"/script/modules/*/hooks/"$1"/"$1".source.sh 1> /dev/null # Cannot call debug() here because invoke-all might be used before # functions are available. source "$GlobalSCRIPTDIR"/core/modules/development/scripts/debug.source.sh "About to call '$f'." 'full' + # shellcheck disable=SC1090 source "$f" done else diff --git a/core/modules/header/hooks/header/header.source.sh b/core/modules/header/hooks/header/header.source.sh index feb526b..a3ad67d 100755 --- a/core/modules/header/hooks/header/header.source.sh +++ b/core/modules/header/hooks/header/header.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash +# shellcheck disable=SC2154 if [ -f "$GlobalSCRIPTDIR"/script/modules/header/files/header.txt ]; then cat "$GlobalSCRIPTDIR"/script/modules/header/files/header.txt else diff --git a/core/modules/help/commands/help/help.source.sh b/core/modules/help/commands/help/help.source.sh index 1c4047f..7a826e2 100755 --- a/core/modules/help/commands/help/help.source.sh +++ b/core/modules/help/commands/help/help.source.sh @@ -1,4 +1,7 @@ +#!/bin/bash + if [ -z "$GlobalARGS" ]; then + # shellcheck disable=SC2154 if [ -f "$GlobalSCRIPTDIR"/script/modules/help/help.txt ]; then cat "$GlobalSCRIPTDIR"/script/modules/help/help.txt else @@ -27,6 +30,7 @@ else fi if [ "$COMMANDEXISTS" == 'false' ]; then + # shellcheck disable=SC2154 echo -e "$GlobalSCRIPTNAME: Invalid command $GlobalARGS" echo -e "See '$GlobalSCRIPTNAME usage' for available commands." exit 1 diff --git a/core/modules/help/commands/usage/usage.source.sh b/core/modules/help/commands/usage/usage.source.sh index 582d20e..fc5e0dc 100755 --- a/core/modules/help/commands/usage/usage.source.sh +++ b/core/modules/help/commands/usage/usage.source.sh @@ -1,4 +1,7 @@ +#!/bin/bash + echo -e "" +# shellcheck disable=SC2154 echo -e "Usage (call $GlobalSCRIPTNAME with no additional arguments to get help):" echo -e "-----" echo -e "" @@ -7,6 +10,7 @@ echo -e "" echo -e "Available global arguments:" echo -e "-----" echo -e "" +# shellcheck disable=SC2154 if [ "$("$GlobalSCRIPTDIR"/core/modules/core/scripts/glob-exists.sh "$GlobalSCRIPTDIR"/core/modules/*/arguments/*/README.md)" == 'true' ]; then head -n 1 "$GlobalSCRIPTDIR"/core/modules/*/arguments/*/README.md | grep -v == | grep -v '^$' else diff --git a/core/modules/help/hooks/usage/usage.source.sh b/core/modules/help/hooks/usage/usage.source.sh index 94fdf70..a75daca 100755 --- a/core/modules/help/hooks/usage/usage.source.sh +++ b/core/modules/help/hooks/usage/usage.source.sh @@ -1,3 +1,6 @@ +#!/bin/bash +# shellcheck disable=SC2154 echo -e "Usage (call $GlobalSCRIPTNAME with no additional arguments to get help):" echo -e "" +# shellcheck disable=SC2154 echo -e "$GlobalSCRIPTNAME [command] [arguments] [parameters]" diff --git a/core/modules/output/hooks/init/init.source.sh b/core/modules/output/hooks/init/init.source.sh index c21d4c8..718a4b8 100755 --- a/core/modules/output/hooks/init/init.source.sh +++ b/core/modules/output/hooks/init/init.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash + function output() { echo "[$2] $3" } diff --git a/core/modules/temporary/hooks/cleanup/cleanup.source.sh b/core/modules/temporary/hooks/cleanup/cleanup.source.sh index 2416654..caff8aa 100755 --- a/core/modules/temporary/hooks/cleanup/cleanup.source.sh +++ b/core/modules/temporary/hooks/cleanup/cleanup.source.sh @@ -1,6 +1,9 @@ +#!/bin/bash + if [ -z "$GlobalRUNID" ]; then echo -e '[error] the cleanup hook expects GlobalRUNID to be set' exit 1; else + # shellcheck disable=SC2154 rm -rf "$GlobalSCRIPTDIR/tmp/$GlobalRUNID" fi diff --git a/core/modules/temporary/hooks/init/init.source.sh b/core/modules/temporary/hooks/init/init.source.sh index 90dade4..b24293d 100755 --- a/core/modules/temporary/hooks/init/init.source.sh +++ b/core/modules/temporary/hooks/init/init.source.sh @@ -1,7 +1,10 @@ +#!/bin/bash + function tmp() { RUNID=$(argvalue internalrunid) LocalTEMPID=$(uuid) + # shellcheck disable=SC2154 LocalTMP="$GlobalSCRIPTDIR/tmp/$RUNID/$LocalTEMPID" mkdir -p "$LocalTMP" echo "$LocalTMP" diff --git a/core/modules/testing/scripts/assert-different.source.sh b/core/modules/testing/scripts/assert-different.source.sh index 48ecd71..94f08ad 100644 --- a/core/modules/testing/scripts/assert-different.source.sh +++ b/core/modules/testing/scripts/assert-different.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash + if [ "$HAYSTACK" == "$NEEDLE" ]; then echo "[fail] both variables are identical: $NEEDLE == $HAYSTACK. $MESSAGE"; ERROR=1; diff --git a/core/modules/testing/scripts/assert-file.source.sh b/core/modules/testing/scripts/assert-file.source.sh index 8128362..091147d 100644 --- a/core/modules/testing/scripts/assert-file.source.sh +++ b/core/modules/testing/scripts/assert-file.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash + if [ -f "$NEEDLE" ]; then echo "[pass] $MESSAGE"; else diff --git a/core/modules/testing/scripts/assert-identical.source.sh b/core/modules/testing/scripts/assert-identical.source.sh index a875a6b..21ea047 100644 --- a/core/modules/testing/scripts/assert-identical.source.sh +++ b/core/modules/testing/scripts/assert-identical.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash + if [ "$HAYSTACK" == "$NEEDLE" ]; then echo "[pass] $MESSAGE"; else diff --git a/core/modules/testing/scripts/assert-no-file.source.sh b/core/modules/testing/scripts/assert-no-file.source.sh index b9d5d8d..d440752 100644 --- a/core/modules/testing/scripts/assert-no-file.source.sh +++ b/core/modules/testing/scripts/assert-no-file.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash + if [ -f "$NEEDLE" ]; then echo "[fail] file $NEEDLE cannot exist. $MESSAGE"; ERROR=1; diff --git a/core/modules/testing/scripts/assert-not.source.sh b/core/modules/testing/scripts/assert-not.source.sh index e69d18f..11098b1 100644 --- a/core/modules/testing/scripts/assert-not.source.sh +++ b/core/modules/testing/scripts/assert-not.source.sh @@ -1,2 +1,4 @@ +#!/bin/bash + # shellcheck disable=SC2015 echo "$HAYSTACK" | grep "$NEEDLE" >> /dev/null && { echo "[fail] $NEEDLE found in $HAYSTACK. Failed: $MESSAGE"; ERROR=1; } || { echo "[pass] $MESSAGE."; } diff --git a/core/modules/testing/scripts/assert.source.sh b/core/modules/testing/scripts/assert.source.sh index 82d2fef..a38541f 100644 --- a/core/modules/testing/scripts/assert.source.sh +++ b/core/modules/testing/scripts/assert.source.sh @@ -1,2 +1,4 @@ +#!/bin/bash + # shellcheck disable=SC2015 echo "$HAYSTACK" | grep "$NEEDLE" >> /dev/null && { echo "[pass] $MESSAGE"; } || { echo "[fail] $NEEDLE not found in $HAYSTACK. Failed: $MESSAGE"; ERROR=1; } diff --git a/core/modules/testing/scripts/cleanup.source.sh b/core/modules/testing/scripts/cleanup.source.sh index 8841de0..0e0a366 100644 --- a/core/modules/testing/scripts/cleanup.source.sh +++ b/core/modules/testing/scripts/cleanup.source.sh @@ -1,7 +1,11 @@ +#!/bin/bash + if [[ "$ERROR" -eq 1 ]]; then + # shellcheck disable=SC2128 echo -e "[error] $(basename "$BASH_SOURCE") Error has been detected, returning 1." exit 1 else + # shellcheck disable=SC2128 echo -e "[pass] $(basename "$BASH_SOURCE") No error detected, returning 0." exit 0 fi diff --git a/core/tests/modules/args/hooks/init/init.source.test.sh b/core/tests/modules/args/hooks/init/init.source.test.sh index 7cc8c87..2c31a3a 100755 --- a/core/tests/modules/args/hooks/init/init.source.test.sh +++ b/core/tests/modules/args/hooks/init/init.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/args/hooks/init/init.source.test/core/modules/args/scripts/arg-value.source.sh b/core/tests/modules/args/hooks/init/init.source.test/core/modules/args/scripts/arg-value.source.sh index cf024e9..8506fd4 100755 --- a/core/tests/modules/args/hooks/init/init.source.test/core/modules/args/scripts/arg-value.source.sh +++ b/core/tests/modules/args/hooks/init/init.source.test/core/modules/args/scripts/arg-value.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo "$1" diff --git a/core/tests/modules/args/scripts/arg-value.source.test.sh b/core/tests/modules/args/scripts/arg-value.source.test.sh index 8ad16ae..a39c338 100755 --- a/core/tests/modules/args/scripts/arg-value.source.test.sh +++ b/core/tests/modules/args/scripts/arg-value.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/args/scripts/arg-value.source.test/core/modules/args/scripts/parse-param.source.sh b/core/tests/modules/args/scripts/arg-value.source.test/core/modules/args/scripts/parse-param.source.sh index 57df32e..c245f90 100755 --- a/core/tests/modules/args/scripts/arg-value.source.test/core/modules/args/scripts/parse-param.source.sh +++ b/core/tests/modules/args/scripts/arg-value.source.test/core/modules/args/scripts/parse-param.source.sh @@ -1,3 +1,5 @@ +#!/bin/bash + if [ "$1" == "test-one" ]; then NAME=firstname VALUE=firstvalue diff --git a/core/tests/modules/args/scripts/parse-arguments.source.test.sh b/core/tests/modules/args/scripts/parse-arguments.source.test.sh index caf8aab..6c0395f 100755 --- a/core/tests/modules/args/scripts/parse-arguments.source.test.sh +++ b/core/tests/modules/args/scripts/parse-arguments.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) @@ -8,9 +10,9 @@ MESSAGE="$BASE/README.md must exist -- there needs to be a README file in the ba source ./core/modules/testing/scripts/assert.source.sh source ./core/modules/testing/scripts/cleanup.source.sh - +# shellcheck disable=SC2317 PARAMS=([0]="--output-test=contains" [1]="a" [2]="space" [3]="--output-test=fully-enclosed" [4]="--output-test=partially" [5]="enclosed") - +# shellcheck disable=SC2317 COMMAND=-output-test=onedash - +# shellcheck disable=SC2317 ARGS=([0]="output-test-no-dash") diff --git a/core/tests/modules/args/scripts/parse-arguments.source.test/core/modules/args/scripts/validate-command.source.sh b/core/tests/modules/args/scripts/parse-arguments.source.test/core/modules/args/scripts/validate-command.source.sh index 2664316..3150d59 100644 --- a/core/tests/modules/args/scripts/parse-arguments.source.test/core/modules/args/scripts/validate-command.source.sh +++ b/core/tests/modules/args/scripts/parse-arguments.source.test/core/modules/args/scripts/validate-command.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'this file is required for testing' diff --git a/core/tests/modules/args/scripts/parse-arguments.source.test/output-test.sh b/core/tests/modules/args/scripts/parse-arguments.source.test/output-test.sh index b3e8486..08fd9b6 100755 --- a/core/tests/modules/args/scripts/parse-arguments.source.test/output-test.sh +++ b/core/tests/modules/args/scripts/parse-arguments.source.test/output-test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + LOCATION=$1 GlobalSCRIPTDIR="$(pwd)/core/tests/modules/args/scripts/parse-arguments.source.test" shift @@ -5,7 +7,7 @@ shift function debug () { : } - +# shellcheck disable=SC1090 source "$LOCATION" set diff --git a/core/tests/modules/args/scripts/parse-param.source.test.sh b/core/tests/modules/args/scripts/parse-param.source.test.sh index fa5e2f5..7299940 100755 --- a/core/tests/modules/args/scripts/parse-param.source.test.sh +++ b/core/tests/modules/args/scripts/parse-param.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/args/scripts/run-command.source.test.sh b/core/tests/modules/args/scripts/run-command.source.test.sh index 6d55628..3cc73b0 100755 --- a/core/tests/modules/args/scripts/run-command.source.test.sh +++ b/core/tests/modules/args/scripts/run-command.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/args/scripts/run-command.source.test/core/modules/whatever/commands/some-command-name/some-command-name.source.sh b/core/tests/modules/args/scripts/run-command.source.test/core/modules/whatever/commands/some-command-name/some-command-name.source.sh index 3c3c3ab..3c684bb 100644 --- a/core/tests/modules/args/scripts/run-command.source.test/core/modules/whatever/commands/some-command-name/some-command-name.source.sh +++ b/core/tests/modules/args/scripts/run-command.source.test/core/modules/whatever/commands/some-command-name/some-command-name.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'command called in script' diff --git a/core/tests/modules/args/scripts/run-command.source.test/script/modules/whatever/commands/some-command-name/some-command-name.source.sh b/core/tests/modules/args/scripts/run-command.source.test/script/modules/whatever/commands/some-command-name/some-command-name.source.sh index ac14cc0..adc3777 100644 --- a/core/tests/modules/args/scripts/run-command.source.test/script/modules/whatever/commands/some-command-name/some-command-name.source.sh +++ b/core/tests/modules/args/scripts/run-command.source.test/script/modules/whatever/commands/some-command-name/some-command-name.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'command called in core' diff --git a/core/tests/modules/args/scripts/run-command.source.test/whatever/modules/whatever/commands/some-command-name/some-command-name.source.sh b/core/tests/modules/args/scripts/run-command.source.test/whatever/modules/whatever/commands/some-command-name/some-command-name.source.sh index fb681c4..6681d55 100644 --- a/core/tests/modules/args/scripts/run-command.source.test/whatever/modules/whatever/commands/some-command-name/some-command-name.source.sh +++ b/core/tests/modules/args/scripts/run-command.source.test/whatever/modules/whatever/commands/some-command-name/some-command-name.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'command called in whatever' diff --git a/core/tests/modules/args/scripts/validate-command.source.test.sh b/core/tests/modules/args/scripts/validate-command.source.test.sh index f8abd29..9fa44aa 100755 --- a/core/tests/modules/args/scripts/validate-command.source.test.sh +++ b/core/tests/modules/args/scripts/validate-command.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/args/scripts/validate-command.source.test/core/modules/whatever/commands/command-in-both-core-and-script/command-in-both-core-and-script.source.sh b/core/tests/modules/args/scripts/validate-command.source.test/core/modules/whatever/commands/command-in-both-core-and-script/command-in-both-core-and-script.source.sh index 3c3c3ab..3c684bb 100644 --- a/core/tests/modules/args/scripts/validate-command.source.test/core/modules/whatever/commands/command-in-both-core-and-script/command-in-both-core-and-script.source.sh +++ b/core/tests/modules/args/scripts/validate-command.source.test/core/modules/whatever/commands/command-in-both-core-and-script/command-in-both-core-and-script.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'command called in script' diff --git a/core/tests/modules/args/scripts/validate-command.source.test/core/modules/whatever/commands/command-only-in-core/command-only-in-core.source.sh b/core/tests/modules/args/scripts/validate-command.source.test/core/modules/whatever/commands/command-only-in-core/command-only-in-core.source.sh index 3c3c3ab..3c684bb 100644 --- a/core/tests/modules/args/scripts/validate-command.source.test/core/modules/whatever/commands/command-only-in-core/command-only-in-core.source.sh +++ b/core/tests/modules/args/scripts/validate-command.source.test/core/modules/whatever/commands/command-only-in-core/command-only-in-core.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'command called in script' diff --git a/core/tests/modules/args/scripts/validate-command.source.test/script/modules/whatever/commands/command-in-both-core-and-script/command-in-both-core-and-script.source.sh b/core/tests/modules/args/scripts/validate-command.source.test/script/modules/whatever/commands/command-in-both-core-and-script/command-in-both-core-and-script.source.sh index 3c3c3ab..3c684bb 100644 --- a/core/tests/modules/args/scripts/validate-command.source.test/script/modules/whatever/commands/command-in-both-core-and-script/command-in-both-core-and-script.source.sh +++ b/core/tests/modules/args/scripts/validate-command.source.test/script/modules/whatever/commands/command-in-both-core-and-script/command-in-both-core-and-script.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'command called in script' diff --git a/core/tests/modules/args/scripts/validate-command.source.test/script/modules/whatever/commands/command-only-in-script/command-only-in-script.source.sh b/core/tests/modules/args/scripts/validate-command.source.test/script/modules/whatever/commands/command-only-in-script/command-only-in-script.source.sh index 3c3c3ab..3c684bb 100644 --- a/core/tests/modules/args/scripts/validate-command.source.test/script/modules/whatever/commands/command-only-in-script/command-only-in-script.source.sh +++ b/core/tests/modules/args/scripts/validate-command.source.test/script/modules/whatever/commands/command-only-in-script/command-only-in-script.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'command called in script' diff --git a/core/tests/modules/args/scripts/validate-command.source.test/whatever/modules/whatever/commands/command-only-in-whatever/command-only-in-whatever.source.sh b/core/tests/modules/args/scripts/validate-command.source.test/whatever/modules/whatever/commands/command-only-in-whatever/command-only-in-whatever.source.sh index 3c3c3ab..3c684bb 100644 --- a/core/tests/modules/args/scripts/validate-command.source.test/whatever/modules/whatever/commands/command-only-in-whatever/command-only-in-whatever.source.sh +++ b/core/tests/modules/args/scripts/validate-command.source.test/whatever/modules/whatever/commands/command-only-in-whatever/command-only-in-whatever.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'command called in script' diff --git a/core/tests/modules/core/hooks/init/init.source.test.sh b/core/tests/modules/core/hooks/init/init.source.test.sh index 4cfdd07..4e952c4 100755 --- a/core/tests/modules/core/hooks/init/init.source.test.sh +++ b/core/tests/modules/core/hooks/init/init.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/core/scripts/glob-exists.test.sh b/core/tests/modules/core/scripts/glob-exists.test.sh index 9e3fe62..97d2681 100755 --- a/core/tests/modules/core/scripts/glob-exists.test.sh +++ b/core/tests/modules/core/scripts/glob-exists.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/core/scripts/uuid.test.sh b/core/tests/modules/core/scripts/uuid.test.sh index 31d846e..40c8796 100755 --- a/core/tests/modules/core/scripts/uuid.test.sh +++ b/core/tests/modules/core/scripts/uuid.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/development/commands/self-test-list/self-test-list.source.test.sh b/core/tests/modules/development/commands/self-test-list/self-test-list.source.test.sh index bbfcd52..deca76f 100755 --- a/core/tests/modules/development/commands/self-test-list/self-test-list.source.test.sh +++ b/core/tests/modules/development/commands/self-test-list/self-test-list.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/development/commands/self-test/self-test.source.test.sh b/core/tests/modules/development/commands/self-test/self-test.source.test.sh index 1a3f270..fac1cbf 100755 --- a/core/tests/modules/development/commands/self-test/self-test.source.test.sh +++ b/core/tests/modules/development/commands/self-test/self-test.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) GlobalSCRIPTDIR="$BASE"/core/tests/modules/development/commands/self-test/self-test.source.test diff --git a/core/tests/modules/development/commands/self-test/self-test.source.test/core/modules/development/scripts/lint.source.sh b/core/tests/modules/development/commands/self-test/self-test.source.test/core/modules/development/scripts/lint.source.sh index 3f7306e..ef9e674 100644 --- a/core/tests/modules/development/commands/self-test/self-test.source.test/core/modules/development/scripts/lint.source.sh +++ b/core/tests/modules/development/commands/self-test/self-test.source.test/core/modules/development/scripts/lint.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'LINTER IS CALLED' diff --git a/core/tests/modules/development/commands/self-test/self-test.source.test/test1-passing-test.sh b/core/tests/modules/development/commands/self-test/self-test.source.test/test1-passing-test.sh index ca916d0..8c3cbfc 100755 --- a/core/tests/modules/development/commands/self-test/self-test.source.test/test1-passing-test.sh +++ b/core/tests/modules/development/commands/self-test/self-test.source.test/test1-passing-test.sh @@ -1 +1,3 @@ +#!/bin/bash + exit 0 diff --git a/core/tests/modules/development/commands/self-test/self-test.source.test/test2-passing-test.sh b/core/tests/modules/development/commands/self-test/self-test.source.test/test2-passing-test.sh index ca916d0..8c3cbfc 100755 --- a/core/tests/modules/development/commands/self-test/self-test.source.test/test2-passing-test.sh +++ b/core/tests/modules/development/commands/self-test/self-test.source.test/test2-passing-test.sh @@ -1 +1,3 @@ +#!/bin/bash + exit 0 diff --git a/core/tests/modules/development/commands/self-test/self-test.source.test/test3-failing-test.sh b/core/tests/modules/development/commands/self-test/self-test.source.test/test3-failing-test.sh index 379a4c9..d87f29e 100755 --- a/core/tests/modules/development/commands/self-test/self-test.source.test/test3-failing-test.sh +++ b/core/tests/modules/development/commands/self-test/self-test.source.test/test3-failing-test.sh @@ -1 +1,3 @@ +#!/bin/bash + exit 1 diff --git a/core/tests/modules/development/hooks/end/end.source.test.sh b/core/tests/modules/development/hooks/end/end.source.test.sh index 5977916..d98eb79 100755 --- a/core/tests/modules/development/hooks/end/end.source.test.sh +++ b/core/tests/modules/development/hooks/end/end.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/development/hooks/init/init.source.test.sh b/core/tests/modules/development/hooks/init/init.source.test.sh index 47fb2a8..1858fbb 100755 --- a/core/tests/modules/development/hooks/init/init.source.test.sh +++ b/core/tests/modules/development/hooks/init/init.source.test.sh @@ -1,7 +1,10 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) -function output() { +function output() { +# shellcheck disable=SC2317 echo "[$2] $3" } diff --git a/core/tests/modules/development/hooks/init/init.source.test/core/tests/core.test.sh b/core/tests/modules/development/hooks/init/init.source.test/core/tests/core.test.sh index fad4110..4d51ed4 100755 --- a/core/tests/modules/development/hooks/init/init.source.test/core/tests/core.test.sh +++ b/core/tests/modules/development/hooks/init/init.source.test/core/tests/core.test.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'this file is required for tests' diff --git a/core/tests/modules/development/hooks/init/init.source.test/core/tests/ignored.whatever.sh b/core/tests/modules/development/hooks/init/init.source.test/core/tests/ignored.whatever.sh index fad4110..4d51ed4 100755 --- a/core/tests/modules/development/hooks/init/init.source.test/core/tests/ignored.whatever.sh +++ b/core/tests/modules/development/hooks/init/init.source.test/core/tests/ignored.whatever.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'this file is required for tests' diff --git a/core/tests/modules/development/hooks/init/init.source.test/ignored/tests/ignored.test.sh b/core/tests/modules/development/hooks/init/init.source.test/ignored/tests/ignored.test.sh index fad4110..4d51ed4 100755 --- a/core/tests/modules/development/hooks/init/init.source.test/ignored/tests/ignored.test.sh +++ b/core/tests/modules/development/hooks/init/init.source.test/ignored/tests/ignored.test.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'this file is required for tests' diff --git a/core/tests/modules/development/hooks/init/init.source.test/script/tests/script.test.sh b/core/tests/modules/development/hooks/init/init.source.test/script/tests/script.test.sh index 3e51f09..11880ec 100755 --- a/core/tests/modules/development/hooks/init/init.source.test/script/tests/script.test.sh +++ b/core/tests/modules/development/hooks/init/init.source.test/script/tests/script.test.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'this file is required' diff --git a/core/tests/modules/development/hooks/init/init.source.test/tests/tests.test.sh b/core/tests/modules/development/hooks/init/init.source.test/tests/tests.test.sh index fad4110..4d51ed4 100755 --- a/core/tests/modules/development/hooks/init/init.source.test/tests/tests.test.sh +++ b/core/tests/modules/development/hooks/init/init.source.test/tests/tests.test.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'this file is required for tests' diff --git a/core/tests/modules/development/scripts/debug.source.test.sh b/core/tests/modules/development/scripts/debug.source.test.sh index f47f211..bd58c27 100755 --- a/core/tests/modules/development/scripts/debug.source.test.sh +++ b/core/tests/modules/development/scripts/debug.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/development/scripts/lint.source.test.sh b/core/tests/modules/development/scripts/lint.source.test.sh index d2685e4..2cdb127 100755 --- a/core/tests/modules/development/scripts/lint.source.test.sh +++ b/core/tests/modules/development/scripts/lint.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/extensibility/hooks/init/init.source.test.sh b/core/tests/modules/extensibility/hooks/init/init.source.test.sh index 2b65007..7ff3c6c 100755 --- a/core/tests/modules/extensibility/hooks/init/init.source.test.sh +++ b/core/tests/modules/extensibility/hooks/init/init.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/extensibility/scripts/invoke-all.source.test.sh b/core/tests/modules/extensibility/scripts/invoke-all.source.test.sh index 11ca96c..056ccfb 100755 --- a/core/tests/modules/extensibility/scripts/invoke-all.source.test.sh +++ b/core/tests/modules/extensibility/scripts/invoke-all.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/extensibility/scripts/invoke-all.source.test/core/modules/development/scripts/debug.source.sh b/core/tests/modules/extensibility/scripts/invoke-all.source.test/core/modules/development/scripts/debug.source.sh index 24803c0..fd88e8f 100644 --- a/core/tests/modules/extensibility/scripts/invoke-all.source.test/core/modules/development/scripts/debug.source.sh +++ b/core/tests/modules/extensibility/scripts/invoke-all.source.test/core/modules/development/scripts/debug.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo "$2" "$1" diff --git a/core/tests/modules/extensibility/scripts/invoke-all.source.test/core/modules/whatever/hooks/some-hook/some-hook.source.sh b/core/tests/modules/extensibility/scripts/invoke-all.source.test/core/modules/whatever/hooks/some-hook/some-hook.source.sh index 58b70d6..66a49f7 100644 --- a/core/tests/modules/extensibility/scripts/invoke-all.source.test/core/modules/whatever/hooks/some-hook/some-hook.source.sh +++ b/core/tests/modules/extensibility/scripts/invoke-all.source.test/core/modules/whatever/hooks/some-hook/some-hook.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'Core hook called' diff --git a/core/tests/modules/extensibility/scripts/invoke-all.source.test/script/modules/whatever/hooks/some-hook/some-hook.source.sh b/core/tests/modules/extensibility/scripts/invoke-all.source.test/script/modules/whatever/hooks/some-hook/some-hook.source.sh index 1433a87..227b8c9 100644 --- a/core/tests/modules/extensibility/scripts/invoke-all.source.test/script/modules/whatever/hooks/some-hook/some-hook.source.sh +++ b/core/tests/modules/extensibility/scripts/invoke-all.source.test/script/modules/whatever/hooks/some-hook/some-hook.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'Script hook called' diff --git a/core/tests/modules/extensibility/scripts/invoke-all.source.test/something-else/modules/whatever/hooks/some-hook/some-hook.source.sh b/core/tests/modules/extensibility/scripts/invoke-all.source.test/something-else/modules/whatever/hooks/some-hook/some-hook.source.sh index 3b7bedb..74ceb6d 100644 --- a/core/tests/modules/extensibility/scripts/invoke-all.source.test/something-else/modules/whatever/hooks/some-hook/some-hook.source.sh +++ b/core/tests/modules/extensibility/scripts/invoke-all.source.test/something-else/modules/whatever/hooks/some-hook/some-hook.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'Random hook called' diff --git a/core/tests/modules/header/files/header.txt.test.sh b/core/tests/modules/header/files/header.txt.test.sh index ec692a9..be3ffa3 100755 --- a/core/tests/modules/header/files/header.txt.test.sh +++ b/core/tests/modules/header/files/header.txt.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + BASE=$(pwd) cat "$BASE"/script/modules/header/files/header.txt diff --git a/core/tests/modules/header/hooks/header/header.source.test.sh b/core/tests/modules/header/hooks/header/header.source.test.sh index c32aa5d..d8038ce 100755 --- a/core/tests/modules/header/hooks/header/header.source.test.sh +++ b/core/tests/modules/header/hooks/header/header.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) GlobalSCRIPTDIR="$(pwd)"/core/tests/modules/header/hooks/header/header.source.test diff --git a/core/tests/modules/help/commands/help/help.source.test.sh b/core/tests/modules/help/commands/help/help.source.test.sh index 62a68d0..22bae14 100755 --- a/core/tests/modules/help/commands/help/help.source.test.sh +++ b/core/tests/modules/help/commands/help/help.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/help/commands/help/help.source.test/some-command/core/modules/whatever/commands/some-command/some-command.source.sh b/core/tests/modules/help/commands/help/help.source.test/some-command/core/modules/whatever/commands/some-command/some-command.source.sh index c7383c2..dd0bd5d 100644 --- a/core/tests/modules/help/commands/help/help.source.test/some-command/core/modules/whatever/commands/some-command/some-command.source.sh +++ b/core/tests/modules/help/commands/help/help.source.test/some-command/core/modules/whatever/commands/some-command/some-command.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'core implementation of some command' diff --git a/core/tests/modules/help/commands/help/help.source.test/some-command/script/modules/whatever/commands/some-command/some-command.source.sh b/core/tests/modules/help/commands/help/help.source.test/some-command/script/modules/whatever/commands/some-command/some-command.source.sh index ef5b5ab..737c268 100644 --- a/core/tests/modules/help/commands/help/help.source.test/some-command/script/modules/whatever/commands/some-command/some-command.source.sh +++ b/core/tests/modules/help/commands/help/help.source.test/some-command/script/modules/whatever/commands/some-command/some-command.source.sh @@ -1 +1,3 @@ +#!/bin/bash + echo 'script implementation of some command' diff --git a/core/tests/modules/help/commands/usage/usage.source.test.sh b/core/tests/modules/help/commands/usage/usage.source.test.sh index 9bc4175..7c3000b 100755 --- a/core/tests/modules/help/commands/usage/usage.source.test.sh +++ b/core/tests/modules/help/commands/usage/usage.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) GlobalSCRIPTNAME='some-script-name.sh' diff --git a/core/tests/modules/help/commands/usage/usage.source.test/core/modules/core/scripts/glob-exists.sh b/core/tests/modules/help/commands/usage/usage.source.test/core/modules/core/scripts/glob-exists.sh index f7f839f..b5c9595 100755 --- a/core/tests/modules/help/commands/usage/usage.source.test/core/modules/core/scripts/glob-exists.sh +++ b/core/tests/modules/help/commands/usage/usage.source.test/core/modules/core/scripts/glob-exists.sh @@ -1 +1,3 @@ +#!/bin/bash + "$(pwd)"/core/modules/core/scripts/glob-exists.sh "$1" diff --git a/core/tests/modules/help/hooks/usage/usage.source.test.sh b/core/tests/modules/help/hooks/usage/usage.source.test.sh index 187a5f0..940c79d 100755 --- a/core/tests/modules/help/hooks/usage/usage.source.test.sh +++ b/core/tests/modules/help/hooks/usage/usage.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) GlobalSCRIPTNAME='some-script-name.sh' diff --git a/core/tests/modules/output/hooks/init/init.source.test.sh b/core/tests/modules/output/hooks/init/init.source.test.sh index 7d1d0f8..e184a3b 100755 --- a/core/tests/modules/output/hooks/init/init.source.test.sh +++ b/core/tests/modules/output/hooks/init/init.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/structure/scripts/main.test.sh b/core/tests/modules/structure/scripts/main.test.sh index 3be25c8..8e6df5b 100755 --- a/core/tests/modules/structure/scripts/main.test.sh +++ b/core/tests/modules/structure/scripts/main.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/temporary/hooks/cleanup/cleanup.source.test.sh b/core/tests/modules/temporary/hooks/cleanup/cleanup.source.test.sh index f6a4c80..05b75eb 100755 --- a/core/tests/modules/temporary/hooks/cleanup/cleanup.source.test.sh +++ b/core/tests/modules/temporary/hooks/cleanup/cleanup.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/temporary/hooks/init/init.source.test.sh b/core/tests/modules/temporary/hooks/init/init.source.test.sh index ceffd19..56b0f28 100755 --- a/core/tests/modules/temporary/hooks/init/init.source.test.sh +++ b/core/tests/modules/temporary/hooks/init/init.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/testing/global-tests/files-have-tests.test.sh b/core/tests/modules/testing/global-tests/files-have-tests.test.sh index 6dec4dd..13686e4 100755 --- a/core/tests/modules/testing/global-tests/files-have-tests.test.sh +++ b/core/tests/modules/testing/global-tests/files-have-tests.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/testing/global-tests/folders-contain-readme.test.sh b/core/tests/modules/testing/global-tests/folders-contain-readme.test.sh index 2affe6a..33c2e69 100755 --- a/core/tests/modules/testing/global-tests/folders-contain-readme.test.sh +++ b/core/tests/modules/testing/global-tests/folders-contain-readme.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) @@ -15,6 +17,7 @@ for i in $(find ./script/modules -maxdepth 1 -type d) do NEEDLE="$i"/README.md MESSAGE="$i/README.md must exist -- all directories need to have a README file." + # shellcheck disable=SC1091 source ./script/modules/testing/scripts/assert-file.source.sh done diff --git a/core/tests/modules/testing/scripts/assert-different.source.test.sh b/core/tests/modules/testing/scripts/assert-different.source.test.sh index 63baacb..5313ba3 100755 --- a/core/tests/modules/testing/scripts/assert-different.source.test.sh +++ b/core/tests/modules/testing/scripts/assert-different.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/testing/scripts/assert-file.source.test.sh b/core/tests/modules/testing/scripts/assert-file.source.test.sh index c6cfe7b..96ad888 100755 --- a/core/tests/modules/testing/scripts/assert-file.source.test.sh +++ b/core/tests/modules/testing/scripts/assert-file.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/testing/scripts/assert-identical.source.test.sh b/core/tests/modules/testing/scripts/assert-identical.source.test.sh index 6315897..d712ba3 100755 --- a/core/tests/modules/testing/scripts/assert-identical.source.test.sh +++ b/core/tests/modules/testing/scripts/assert-identical.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/testing/scripts/assert-no-file.source.test.sh b/core/tests/modules/testing/scripts/assert-no-file.source.test.sh index 8ff2b18..25756ee 100755 --- a/core/tests/modules/testing/scripts/assert-no-file.source.test.sh +++ b/core/tests/modules/testing/scripts/assert-no-file.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/testing/scripts/assert-not.source.test.sh b/core/tests/modules/testing/scripts/assert-not.source.test.sh index 974ce69..058931c 100755 --- a/core/tests/modules/testing/scripts/assert-not.source.test.sh +++ b/core/tests/modules/testing/scripts/assert-not.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/testing/scripts/assert.source.test.sh b/core/tests/modules/testing/scripts/assert.source.test.sh index 0a3b467..41bc55c 100755 --- a/core/tests/modules/testing/scripts/assert.source.test.sh +++ b/core/tests/modules/testing/scripts/assert.source.test.sh @@ -1,3 +1,5 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) diff --git a/core/tests/modules/testing/scripts/cleanup.source.test.sh b/core/tests/modules/testing/scripts/cleanup.source.test.sh index 19bbe31..d0de6f6 100755 --- a/core/tests/modules/testing/scripts/cleanup.source.test.sh +++ b/core/tests/modules/testing/scripts/cleanup.source.test.sh @@ -1,18 +1,28 @@ +#!/bin/bash + ERROR=0 BASE=$(pwd) MESSAGE='cleanup exits with the proper code' HAYSTACK='ok' - +# shellcheck disable=SC2317 source "$BASE"/core/modules/testing/scripts/cleanup.source.sh || HAYSTACK='BAD' +# shellcheck disable=SC2317 NEEDLE='ok' +# shellcheck disable=SC2317 source ./core/modules/testing/scripts/assert-identical.source.sh +# shellcheck disable=SC2317 HAYSTACK='ok' +# shellcheck disable=SC2317 ERROR=1 +# shellcheck disable=SC2317 source "$BASE"/core/modules/testing/scripts/cleanup.source.sh || HAYSTACK='BAD' +# shellcheck disable=SC2317 NEEDLE='BAD' +# shellcheck disable=SC2317 source ./core/modules/testing/scripts/assert-identical.source.sh +# shellcheck disable=SC2317 ERROR=0 - +# shellcheck disable=SC2317 source ./core/modules/testing/scripts/cleanup.source.sh diff --git a/script/modules/check/commands/check/check-single.source.sh b/script/modules/check/commands/check/check-single.source.sh index e656350..15662f9 100644 --- a/script/modules/check/commands/check/check-single.source.sh +++ b/script/modules/check/commands/check/check-single.source.sh @@ -1,3 +1,4 @@ +#!/bin/bash MYERR="" DATE=$(echo | openssl s_client -servername "$SITE" -connect "$SITE":443 2>/dev/null | openssl x509 -noout -dates | grep notAfter) || MYERR="NOCERT" diff --git a/script/modules/check/commands/check/check.source.sh b/script/modules/check/commands/check/check.source.sh index 76feb0f..6789029 100755 --- a/script/modules/check/commands/check/check.source.sh +++ b/script/modules/check/commands/check/check.source.sh @@ -1,3 +1,4 @@ +#!/bin/bash DAYS=$(argvalue days) SITES=$(argvalue sites) diff --git a/script/modules/check/commands/check/convert.source.sh b/script/modules/check/commands/check/convert.source.sh index 3bbb00c..af0021f 100644 --- a/script/modules/check/commands/check/convert.source.sh +++ b/script/modules/check/commands/check/convert.source.sh @@ -1,3 +1,4 @@ +#!/bin/bash if hash sw_vers 2>/dev/null; then # On mac OS CONVERTEDDATE=$(date -jf "%b %d %H:%M:%S %Y %Z" -v -20S "$DATETOCONVERT" "+%s") diff --git a/script/modules/check/commands/check/today.source.sh b/script/modules/check/commands/check/today.source.sh index e3bb971..8b0199f 100644 --- a/script/modules/check/commands/check/today.source.sh +++ b/script/modules/check/commands/check/today.source.sh @@ -1 +1,2 @@ +#!/bin/bash TODAY=$(date "+%b %d %H:%M:%S %Y %Z") diff --git a/script/modules/letsencrypt-automation/convert-output-to-commands.sh b/script/modules/letsencrypt-automation/convert-output-to-commands.sh index 175dc51..ee34835 100755 --- a/script/modules/letsencrypt-automation/convert-output-to-commands.sh +++ b/script/modules/letsencrypt-automation/convert-output-to-commands.sh @@ -18,8 +18,8 @@ TEST_FILE="$3" DOCROOT="$4" # Clear the destination and test files -> "$DEST_FILE" -> "$TEST_FILE" +echo "" > "$DEST_FILE" +echo "" > "$TEST_FILE" # Add the directory creation command to dest.txt echo "mkdir -p $DOCROOT/.well-known/acme-challenge" >> "$DEST_FILE" @@ -27,6 +27,10 @@ echo "mkdir -p $DOCROOT/.well-known/acme-challenge" >> "$DEST_FILE" # Generate a random cache-buster value CACHE_BUSTER=$((RANDOM % 9999 + 1)) +# Track if any relevant data was written (start both as false since mkdir is always written) +DEST_FILE_WRITTEN=false +TEST_FILE_WRITTEN=false + # Process the source file. Read lines of source.txt one by one. while IFS= read -r line; do # Trim trailing whitespace @@ -39,6 +43,7 @@ while IFS= read -r line; do # Append to dest.txt echo "echo '$FILENAME' > $DOCROOT/.well-known/acme-challenge/${FILENAME%%.*}" >> "$DEST_FILE" + DEST_FILE_WRITTEN=true fi # Match the line containing the URL @@ -48,11 +53,12 @@ while IFS= read -r line; do # Append to test.txt with the generated cache-buster value echo "curl -L \"$URL?cache-buster=$CACHE_BUSTER\"" >> "$TEST_FILE" + TEST_FILE_WRITTEN=true fi done < "$SOURCE_FILE" # Check if both files have been written -if [[ -s "$DEST_FILE" && -s "$TEST_FILE" ]]; then +if $DEST_FILE_WRITTEN && $TEST_FILE_WRITTEN; then echo "Commands written to $DEST_FILE and $TEST_FILE." else echo "An error occurred or files are empty." diff --git a/tests/cem.test.sh b/tests/cem.test.sh index 8fb34da..c7c593e 100755 --- a/tests/cem.test.sh +++ b/tests/cem.test.sh @@ -1,3 +1,4 @@ +#!/bin/bash set -e RESULT=$(./cem.sh internal-test /tests/cem/happy) @@ -13,4 +14,4 @@ RESULT=$(./cem.sh internal-test /tests/cem/sad) || FAIL=1 # even in the case of a failure we clean up before quitting. echo "$RESULT" | grep 'INVOKE CALLED' > /dev/null -echo $FAIL | grep 1 > /dev/null +echo "$FAIL" | grep 1 > /dev/null diff --git a/tests/cem/happy/core/modules/extensibility/scripts/invoke-all.source.sh b/tests/cem/happy/core/modules/extensibility/scripts/invoke-all.source.sh index b1eb4fd..aa789c3 100755 --- a/tests/cem/happy/core/modules/extensibility/scripts/invoke-all.source.sh +++ b/tests/cem/happy/core/modules/extensibility/scripts/invoke-all.source.sh @@ -1 +1,2 @@ +#!/bin/bash echo "INVOKE CALLED WITH $1" diff --git a/tests/cem/happy/core/modules/structure/scripts/main.sh b/tests/cem/happy/core/modules/structure/scripts/main.sh index b3cd672..6671688 100755 --- a/tests/cem/happy/core/modules/structure/scripts/main.sh +++ b/tests/cem/happy/core/modules/structure/scripts/main.sh @@ -1 +1,2 @@ +#!/bin/bash echo "MAIN SCRIPT CALLED WITH $*" diff --git a/tests/cem/sad/core/modules/extensibility/scripts/invoke-all.source.sh b/tests/cem/sad/core/modules/extensibility/scripts/invoke-all.source.sh index b1eb4fd..aa789c3 100755 --- a/tests/cem/sad/core/modules/extensibility/scripts/invoke-all.source.sh +++ b/tests/cem/sad/core/modules/extensibility/scripts/invoke-all.source.sh @@ -1 +1,2 @@ +#!/bin/bash echo "INVOKE CALLED WITH $1" diff --git a/tests/cem/sad/core/modules/structure/scripts/main.sh b/tests/cem/sad/core/modules/structure/scripts/main.sh index 379a4c9..afe8ade 100755 --- a/tests/cem/sad/core/modules/structure/scripts/main.sh +++ b/tests/cem/sad/core/modules/structure/scripts/main.sh @@ -1 +1,2 @@ +#!/bin/bash exit 1 diff --git a/tests/letsencrypt-automation-tests/test.sh b/tests/letsencrypt-automation-tests/test.sh index cbe4816..9736b2e 100755 --- a/tests/letsencrypt-automation-tests/test.sh +++ b/tests/letsencrypt-automation-tests/test.sh @@ -31,7 +31,7 @@ empty_file_if_exists() { local FILE="$1" if [[ -e $FILE ]]; then - > "$FILE" # Empty the file + echo "" > "$FILE" # Empty the file fi } @@ -130,24 +130,20 @@ echo file_two.txt > ./docroot/.well-known/acme-challenge/file_two.txt" >> ./unve # Define the file and string to search for FILE="./unversioned/test2-actual-test.txt" # Replace with your actual file name - SEARCH_STRING2='curl -L "http://example.com/.well-known/acme-challenge/file_one.txt?cache-buster=' + SEARCH_STRING_ONE='curl -L "http://example.com/.well-known/acme-challenge/file_one.txt?cache-buster=' # Call the function - check_string_in_file "$FILE" "$SEARCH_STRING1" - - # Call the function - if check_string_in_file "$FILE" "$SEARCH_STRING1"; then + if check_string_in_file "$FILE" "$SEARCH_STRING_ONE"; then echo "Test case 2.1 passed." else echo "Test case 2.1 failed." return 1 # Return failure fi - SEARCH_STRING2='curl -L "http://example.com/.well-known/acme-challenge/file_two.txt?cache-buster=' - check_string_in_file "$FILE" "$SEARCH_STRING2" + SEARCH_STRING_TWO='curl -L "http://example.com/.well-known/acme-challenge/file_two.txt?cache-buster=' # Call the function - if check_string_in_file "$FILE" "$SEARCH_STRING2"; then + if check_string_in_file "$FILE" "$SEARCH_STRING_TWO"; then echo "Test case 2.2 passed." return 0 # Return success else @@ -197,7 +193,7 @@ run_test_case_4() { # Function for Empty Source File Test run_test_case_5() { echo "Running Empty Source File Test..." - >./unversioned/test5-source.txt # Create an empty source file + echo "" > ./unversioned/test5-source.txt # Create an empty source file OUTPUT=$($SCRIPT_PATH ./unversioned/test5-source.txt ./unversioned/test5-dest.txt ./unversioned/test5-test.txt ./docroot 2>&1) # Check for the specific error message