refactor: move all shellcheck disable definitions to .shellcheckrc file
This makes standard use of shellcheck work without needing to provide extra configuration anywhere. Also remove use of inline 'shellcheck disable' calls that are already defined in the .shellcheckrc and don't need to be set inline.
This commit is contained in:
@@ -159,7 +159,6 @@ create_package() {
|
||||
build_dokku
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2120
|
||||
setup_circle() {
|
||||
install_dependencies
|
||||
install_dokku
|
||||
@@ -188,12 +187,10 @@ case "$1" in
|
||||
run_dokku_container
|
||||
;;
|
||||
build)
|
||||
# shellcheck disable=SC2119
|
||||
create_package
|
||||
exit $?
|
||||
;;
|
||||
*)
|
||||
# shellcheck disable=SC2119
|
||||
setup_circle
|
||||
exit $?
|
||||
;;
|
||||
|
||||
@@ -21,7 +21,6 @@ is_number "$BATCH_NUM" || usage
|
||||
TESTS=$(find "$(dirname "$0")/../unit" -maxdepth 1 -name "${BATCH_NUM}0*.bats" | sort -n | xargs)
|
||||
echo "running the following tests $TESTS"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
for test in $TESTS; do
|
||||
echo $test
|
||||
starttest=$(date +%s)
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
# SC1001 - This \/ will be a regular '/' in this context - https://github.com/koalaman/shellcheck/wiki/SC1001
|
||||
# SC1003 - Want to escape a single quote? echo 'This is how it'\''s done' - https://github.com/koalaman/shellcheck/wiki/SC1003
|
||||
# SC1090 - Can't follow non-constant source. Use a directive to specify location - https://github.com/koalaman/shellcheck/wiki/SC1090
|
||||
# SC1091 - Not following: FILE: does not exist (No such file or directory) - https://github.com/koalaman/shellcheck/wiki/SC1091
|
||||
# SC1117 - Backslash is literal in "\n". Prefer explicit escaping: "\\n" - https://github.com/koalaman/shellcheck/wiki/SC1117
|
||||
# SC2029 - Note that, unescaped, this expands on the client side - https://github.com/koalaman/shellcheck/wiki/SC2029
|
||||
# SC2030 - Modification of var is local (to subshell caused by pipeline). - https://github.com/koalaman/shellcheck/wiki/SC2030
|
||||
# SC2031 - var was modified in a subshell. That change might be lost. - https://github.com/koalaman/shellcheck/wiki/SC2031
|
||||
# SC2034 - VAR appears unused - https://github.com/koalaman/shellcheck/wiki/SC2034
|
||||
# SC2046 - Quote this to prevent word splitting - https://github.com/koalaman/shellcheck/wiki/SC2046
|
||||
# SC2064 - Use single quotes, otherwise this expands now rather than when signalled. - https://github.com/koalaman/shellcheck/wiki/SC2064
|
||||
# SC2068 - Double quote array expansions to avoid re-splitting elements - https://github.com/koalaman/shellcheck/wiki/SC2068
|
||||
# SC2086 - Double quote to prevent globbing and word splitting - https://github.com/koalaman/shellcheck/wiki/SC2086
|
||||
# SC2119 - Use 'function "$@"' if function's $1 should mean script's $1 - https://github.com/koalaman/shellcheck/wiki/SC2119
|
||||
# SC2120 - Function references arguments, but none are ever passed - https://github.com/koalaman/shellcheck/wiki/SC2120
|
||||
# SC2128 - Expanding an array without an index only gives the first element - https://github.com/koalaman/shellcheck/wiki/SC2128
|
||||
# SC2148 - Tips depend on target shell and yours is unknown. Add a shebang - https://github.com/koalaman/shellcheck/wiki/SC2148
|
||||
# SC2153 - Possible misspelling: DOKKU_ROOT may not be assigned, but DOKKU_PORT is - https://github.com/koalaman/shellcheck/wiki/SC2153
|
||||
# SC2154 - passed_docker_option is referenced but not assigned - https://github.com/koalaman/shellcheck/wiki/SC2154
|
||||
# SC2155 - Declare and assign separately to avoid masking return values - https://github.com/koalaman/shellcheck/wiki/SC2155
|
||||
# SC2162 - read without -r will mangle backslashes - https://github.com/koalaman/shellcheck/wiki/SC2162
|
||||
# SC2174 - When used with -p, -m only applies to the deepest directory - https://github.com/koalaman/shellcheck/wiki/SC2174
|
||||
# SC2179 - Use array+=("item") to append items to an array - https://github.com/koalaman/shellcheck/wiki/SC2179
|
||||
# SC2191 - The = here is literal. To assign by index, use ( [index]=value ) with no spaces. To keep as literal, quote it - https://github.com/koalaman/shellcheck/wiki/SC2191
|
||||
# SC2199 - Arrays implicitly concatenate in [[ ]]. Use a loop (or explicit * instead of @) - https://github.com/koalaman/shellcheck/wiki/SC2199
|
||||
# SC2207 - Prefer mapfile or read -a to split command output (or quote to avoid splitting) - https://github.com/koalaman/shellcheck/wiki/SC2207
|
||||
# SC2219 - Instead of 'let expr', prefer (( expr )) - https://github.com/koalaman/shellcheck/wiki/SC2219
|
||||
# SC2220 - Invalid flags are not handled. Add a *) case - https://github.com/koalaman/shellcheck/wiki/SC2220
|
||||
# SC2231 - Quote expansions in this for loop glob to prevent wordsplitting, e.g. "$dir"/*.txt - https://github.com/koalaman/shellcheck/wiki/SC2231
|
||||
# SC2235 - Use { ..; } instead of (..) to avoid subshell overhead - https://github.com/koalaman/shellcheck/wiki/SC2235
|
||||
# SC2267 - GNU xargs -i is deprecated in favor of -I{} - https://github.com/koalaman/shellcheck/wiki/SC2267
|
||||
# SC2295 - Expansions inside ${..} need to be quoted separately, otherwise they match as patterns - https://github.com/koalaman/shellcheck/wiki/SC2295
|
||||
@@ -13,7 +13,6 @@ REPO="test-$(basename "$APP")-$RANDOM"
|
||||
ssh "$REMOTE" events:on
|
||||
|
||||
destroy_app() {
|
||||
# shellcheck disable=SC2029
|
||||
ssh "$REMOTE" apps:destroy "$REPO" --force
|
||||
ssh "$REMOTE" events:off
|
||||
}
|
||||
@@ -63,7 +62,6 @@ fi
|
||||
|
||||
ssh "$REMOTE" events
|
||||
ssh "$REMOTE" apps:list
|
||||
# shellcheck disable=SC2029
|
||||
URL=$(ssh "$REMOTE" url "$REPO")$FORWARDED_PORT
|
||||
sleep 2
|
||||
if (./check_deploy "$URL"); then
|
||||
|
||||
@@ -57,8 +57,6 @@ flunk() {
|
||||
}
|
||||
|
||||
# ShellCheck doesn't know about $status from Bats
|
||||
# shellcheck disable=SC2154
|
||||
# shellcheck disable=SC2120
|
||||
assert_success() {
|
||||
if [[ "$status" -ne 0 ]]; then
|
||||
flunk "command failed with exit status $status"
|
||||
@@ -68,8 +66,6 @@ assert_success() {
|
||||
}
|
||||
|
||||
# ShellCheck doesn't know about $status from Bats
|
||||
# shellcheck disable=SC2154
|
||||
# shellcheck disable=SC2120
|
||||
assert_failure() {
|
||||
if [[ "$status" -eq 0 ]]; then
|
||||
flunk "expected failed exit status"
|
||||
@@ -97,7 +93,6 @@ assert_not_equal() {
|
||||
}
|
||||
|
||||
# ShellCheck doesn't know about $output from Bats
|
||||
# shellcheck disable=SC2154
|
||||
assert_output() {
|
||||
local expected
|
||||
if [[ $# -eq 0 ]]; then
|
||||
@@ -109,7 +104,6 @@ assert_output() {
|
||||
}
|
||||
|
||||
# ShellCheck doesn't know about $output from Bats
|
||||
# shellcheck disable=SC2154
|
||||
assert_not_output() {
|
||||
local expected
|
||||
if [[ $# -eq 0 ]]; then
|
||||
@@ -121,19 +115,16 @@ assert_not_output() {
|
||||
}
|
||||
|
||||
# ShellCheck doesn't know about $output from Bats
|
||||
# shellcheck disable=SC2154
|
||||
assert_output_exists() {
|
||||
[[ -n "$output" ]] || flunk "expected output, found none"
|
||||
}
|
||||
|
||||
# ShellCheck doesn't know about $output from Bats
|
||||
# shellcheck disable=SC2154
|
||||
assert_output_not_exists() {
|
||||
[[ -z "$output" ]] || flunk "expected no output, found some"
|
||||
}
|
||||
|
||||
# ShellCheck doesn't know about $output from Bats
|
||||
# shellcheck disable=SC2154
|
||||
assert_output_contains() {
|
||||
local input="$output"
|
||||
local expected="$1"
|
||||
@@ -147,7 +138,6 @@ assert_output_contains() {
|
||||
}
|
||||
|
||||
# ShellCheck doesn't know about $lines from Bats
|
||||
# shellcheck disable=SC2154
|
||||
assert_line() {
|
||||
if [[ "$1" -ge 0 ]] 2>/dev/null; then
|
||||
assert_equal "$2" "${lines[$1]}"
|
||||
@@ -161,7 +151,6 @@ assert_line() {
|
||||
}
|
||||
|
||||
# ShellCheck doesn't know about $lines from Bats
|
||||
# shellcheck disable=SC2154
|
||||
assert_line_count() {
|
||||
declare EXPECTED="$1"
|
||||
local num_lines="${#lines[@]}"
|
||||
@@ -218,7 +207,6 @@ destroy_key() {
|
||||
rm -f /tmp/testkey* &>/dev/null || true
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2119
|
||||
check_urls() {
|
||||
local PATTERN="$1"
|
||||
run /bin/bash -c "dokku urls $TEST_APP | grep -E \"${PATTERN}\""
|
||||
@@ -320,7 +308,6 @@ deploy_app() {
|
||||
|
||||
rmdir "$TMP" && cp -r "${BATS_TEST_DIRNAME}/../../tests/apps/$APP_TYPE" "$TMP"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
[[ -n "$CUSTOM_TEMPLATE" ]] && $CUSTOM_TEMPLATE $TEST_APP $TMP/$CUSTOM_PATH
|
||||
|
||||
pushd "$TMP" &>/dev/null || exit 1
|
||||
|
||||
Reference in New Issue
Block a user