From b8935ec266d2c5f7f364c6024730e4d68432cce3 Mon Sep 17 00:00:00 2001 From: Koichi Nakashima Date: Tue, 3 May 2022 10:33:31 +0900 Subject: [PATCH] Update shellcheck version --- .shellcheck-version | 2 +- examples/spec/17.putsn_puts_directive_spec.sh | 1 + examples/spec/18.const_directive_spec.sh | 1 + examples/spec/22.sourcced_spec.sh | 10 ++++----- helper/spec_helper.sh | 7 +++++- install.sh | 3 ++- lib/bootstrap.sh | 2 +- lib/core/evaluation.sh | 1 + lib/core/utils.sh | 2 +- lib/general.sh | 22 +++++++++++++------ .../optparser/parser_definition_generated.sh | 2 +- lib/libexec/reporter.sh | 2 ++ .../reporter/documentation_formatter.sh | 1 + lib/libexec/reporter/formatter.sh | 2 +- lib/libexec/reporter/junit_formatter.sh | 2 +- lib/libexec/shellspec.sh | 4 +++- lib/support-bin.sh | 2 +- libexec/shellspec-executor.sh | 2 +- libexec/shellspec-inspection.sh | 20 +++++++++-------- libexec/shellspec-prechecker.sh | 1 + libexec/shellspec-runner.sh | 8 +++---- libexec/shellspec-unreadonly-path.sh | 2 +- shellspec | 6 ++--- spec/bootstrap_spec.sh | 2 +- spec/core/clone_spec.sh | 16 +++++++------- spec/core/dsl/assert_spec.sh | 2 +- spec/core/dsl/before_after_all_spec.sh | 2 +- spec/core/dsl/before_after_each_spec.sh | 2 +- spec/core/dsl/data_spec.sh | 2 +- spec/core/dsl/directives_spec.sh | 3 ++- spec/core/dsl/include_spec.sh | 2 +- spec/core/dsl/mock_spec.sh | 4 ++-- spec/core/dsl/parameters_spec.sh | 4 ++-- spec/core/dsl/text_spec.sh | 2 +- spec/core/dsl_spec.sh | 2 +- spec/core/evaluation_spec.sh | 2 +- spec/core/file_descriptor_spec.sh | 2 +- spec/core/hook_spec.sh | 2 +- spec/core/matchers/be/empty_spec.sh | 2 +- spec/core/matchers/be/stat_spec.sh | 2 +- spec/core/matchers/be/status_spec.sh | 2 +- spec/core/matchers/be/valid_spec.sh | 2 +- spec/core/matchers/be/variable_spec.sh | 2 +- spec/core/matchers/end_with_spec.sh | 2 +- spec/core/matchers/equal_spec.sh | 2 +- spec/core/matchers/have/stat_spec.sh | 2 +- spec/core/matchers/include_spec.sh | 2 +- spec/core/matchers/match_spec.sh | 2 +- spec/core/matchers/satisfy_spec.sh | 2 +- spec/core/matchers/start_with_spec.sh | 2 +- spec/core/matchers_spec.sh | 2 +- spec/core/modifiers/contents_spec.sh | 2 +- spec/core/modifiers/length_spec.sh | 2 +- spec/core/modifiers/line_spec.sh | 2 +- spec/core/modifiers/lines_spec.sh | 2 +- spec/core/modifiers/result_spec.sh | 2 +- spec/core/modifiers/word_spec.sh | 2 +- spec/core/output_spec.sh | 2 +- spec/core/outputs_spec.sh | 2 +- spec/core/statement_spec.sh | 2 +- spec/core/subjects/fd_spec.sh | 4 ++-- spec/core/subjects/line_spec.sh | 2 +- spec/core/subjects/path_spec.sh | 2 +- spec/core/subjects/status_spec.sh | 2 +- spec/core/subjects/stderr_spec.sh | 2 +- spec/core/subjects/stdout_spec.sh | 2 +- spec/core/subjects/value_spec.sh | 2 +- spec/core/subjects/variable_spec.array.sh | 2 +- spec/core/subjects/variable_spec.sh | 2 +- spec/core/subjects/word_spec.sh | 2 +- spec/core/subjects_spec.sh | 2 +- spec/core/switch_spec.sh | 2 +- spec/core/syntax_spec.sh | 2 +- spec/core/utils_spec.sh | 4 ++-- spec/core/verb_spec.sh | 2 +- spec/cov/kcov_spec.sh | 2 +- spec/general_spec.sh | 2 +- spec/getoptions_abbr_spec.sh | 2 +- spec/getoptions_help_spec.sh | 2 +- spec/getoptions_spec.sh | 2 +- spec/install_spec.sh | 2 +- spec/libexec/binary_spec.sh | 2 +- spec/libexec/executor_spec.sh | 2 +- spec/libexec/grammar_spec.sh | 2 +- spec/libexec/kcov-executor_spec.sh | 2 +- spec/libexec/list_spec.sh | 2 +- spec/libexec/optparser/optparser_spec.sh | 2 +- .../optparser/parser_definition_spec.sh | 2 +- spec/libexec/prechecker_spec.sh | 2 +- spec/libexec/reporter_spec.sh | 3 ++- spec/libexec/runner_spec.sh | 2 +- spec/libexec/shellspec_spec.sh | 3 ++- spec/libexec/task_spec.sh | 2 +- spec/libexec/translator_spec.sh | 2 +- spec/libexec_spec.sh | 2 +- spec/semver_spec.sh | 2 +- spec/shellspec-gen-bin_spec.sh | 2 +- spec/shellspec-init_spec.sh | 2 +- spec/shellspec-inspection_spec.sh | 2 +- spec/shellspec-load-env_spec.sh | 2 +- spec/shellspec-prechecker_spec.sh | 2 +- spec/shellspec-task_spec.sh | 2 +- spec/support-bin_spec.sh | 2 +- 103 files changed, 159 insertions(+), 131 deletions(-) diff --git a/.shellcheck-version b/.shellcheck-version index 63f2359f..b19b5211 100644 --- a/.shellcheck-version +++ b/.shellcheck-version @@ -1 +1 @@ -v0.7.1 +v0.8.0 diff --git a/examples/spec/17.putsn_puts_directive_spec.sh b/examples/spec/17.putsn_puts_directive_spec.sh index 67df4684..1f427bbf 100644 --- a/examples/spec/17.putsn_puts_directive_spec.sh +++ b/examples/spec/17.putsn_puts_directive_spec.sh @@ -10,6 +10,7 @@ End Describe '%= directive' Example 'is alias for %putsn' + # shellcheck disable=SC2276 foo() { %= value; } When call foo The entire output should eq "value${SHELLSPEC_LF}" diff --git a/examples/spec/18.const_directive_spec.sh b/examples/spec/18.const_directive_spec.sh index 34a2f4bb..fdd67d60 100644 --- a/examples/spec/18.const_directive_spec.sh +++ b/examples/spec/18.const_directive_spec.sh @@ -1,6 +1,7 @@ #shellcheck shell=sh %const NAME: value +# shellcheck disable=SC2288 % MAJOR_VERSION: "${SHELLSPEC_VERSION%%.*}" # % OK: "$(echo_ok)" # echo_ok not found diff --git a/examples/spec/22.sourcced_spec.sh b/examples/spec/22.sourcced_spec.sh index d4213283..8e066932 100644 --- a/examples/spec/22.sourcced_spec.sh +++ b/examples/spec/22.sourcced_spec.sh @@ -22,11 +22,11 @@ Describe 'sourced return example' Example 'test cpunum.sh with stubbed cat /cpu/info' Data data data() { - %= "line1" - %= "line2" - %= "line3" - %= "line4" - %- "line5 (without newline)" + %putsn "line1" + %putsn "line2" + %putsn "line3" + %putsn "line4" + %puts "line5 (without newline)" } When call count_lines diff --git a/helper/spec_helper.sh b/helper/spec_helper.sh index 33289fec..ebd0d112 100644 --- a/helper/spec_helper.sh +++ b/helper/spec_helper.sh @@ -7,6 +7,8 @@ spec_helper_precheck() { minimum_version "$SHELLSPEC_VERSION" if [ "${PIPEFAIL:-}" ]; then + # TODO: set -o pipefail will be allowed in POSIX issue 8 + # shellcheck disable=SC3040 if ( set -o pipefail ) 2>/dev/null; then info "pipefail enabled" else @@ -16,6 +18,7 @@ spec_helper_precheck() { fi if [ "${EXTGLOB:-}" ]; then + # shellcheck disable=SC3044 if shopt -s extglob 2>/dev/null; then info "extglob enabled" setenv EXTGLOB="extglob" @@ -34,14 +37,16 @@ spec_helper_precheck() { fi } -# shellcheck disable=SC2039 spec_helper_loaded() { # http://redsymbol.net/articles/unofficial-bash-strict-mode/ + # shellcheck disable=SC2153 IFS="${SHELLSPEC_LF}${SHELLSPEC_TAB}" + # shellcheck disable=SC3040 [ "${PIPEFAIL:-}" ] && set -o pipefail unset PIPEFAIL ||: + # shellcheck disable=SC3044 case ${EXTGLOB:-} in extglob) shopt -s extglob ;; extendedglob) setopt extendedglob ;; diff --git a/install.sh b/install.sh index 42c24a76..f10c1cc8 100755 --- a/install.sh +++ b/install.sh @@ -113,6 +113,7 @@ components_path() { git_remote_tags() { git ls-remote --tags "$repo" | while read -r line; do + # shellcheck disable=SC2295 tag=${line##*/} && pre=${tag#${tag%%[-+]*}} [ "${1:-}" = "--pre" ] || case $pre in (-*) continue; esac echo "${tag%\^\{\}}" @@ -130,7 +131,7 @@ sort_by_first_key() { version_sort() { while read -r version; do - ver=${version%%+*} && num=${ver%%-*} && pre=${ver#$num} + ver=${version%%+*} && num=${ver%%-*} && pre=${ver#"$num"} #shellcheck disable=SC2086 case $num in *[!0-9.]*) set -- 0 0 0 0 ;; diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index 03fdb50b..13fbf6da 100644 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -3,7 +3,7 @@ shellspec() { echo '#'; } # Disable verbose_errexit by default for osh -# shellcheck disable=SC2039 +# shellcheck disable=SC3044 shopt -u verbose_errexit 2>/dev/null ||: # shellcheck source=lib/general.sh diff --git a/lib/core/evaluation.sh b/lib/core/evaluation.sh index 161e55a8..a59b9e92 100644 --- a/lib/core/evaluation.sh +++ b/lib/core/evaluation.sh @@ -255,6 +255,7 @@ shellspec_interceptor() { done shift 2 case $SHELLSPEC_INTERCEPTOR in (*\|$1:*) + # shellcheck disable=SC2295 eval "shift; set -- \"${SHELLSPEC_INTERCEPTOR##*\|$1:}\" ${2:+\"\$@\"}" eval "shift; set -- \"${1%%\|*}\" ${2:+\"\$@\"}" "$@" diff --git a/lib/core/utils.sh b/lib/core/utils.sh index 21053176..75b02d77 100644 --- a/lib/core/utils.sh +++ b/lib/core/utils.sh @@ -55,7 +55,7 @@ shellspec_set_option() { } shellspec_shopt() { - #shellcheck disable=SC2039 + #shellcheck disable=SC3044 case $1 in -o) shopt -s "$2" 2>/dev/null || set -o "$2" ;; +o) shopt -u "$2" 2>/dev/null || set +o "$2" ;; diff --git a/lib/general.sh b/lib/general.sh index 2d1d579a..f6df5735 100644 --- a/lib/general.sh +++ b/lib/general.sh @@ -96,6 +96,7 @@ shellspec_resolve_module_path() { shellspec_find_module "$SHELLSPEC_LOAD_PATH" "$2" "$1" } +# shellcheck disable=SC2295 shellspec_module_exists() { set -- "$1" "${2:-$SHELLSPEC_LOAD_PATH}" [ -e "${2%%$SHELLSPEC_PATHSEP*}/$1.sh" ] && return 0 @@ -107,6 +108,7 @@ shellspec_module_exists() { return 1 } +# shellcheck disable=SC2295 shellspec_find_module() { if [ -e "${1%%$SHELLSPEC_PATHSEP*}/$2.sh" ]; then eval "$3=\${1%%\$SHELLSPEC_PATHSEP*}/\$2.sh" @@ -275,6 +277,7 @@ shellspec_loop() { shellspec_loop "$1" $(($2 - 1)) } +# shellcheck disable=SC2295 shellspec_get_line() { [ "$2" -le 0 ] && set -- "$1" "$2" "" while [ "$2" -gt 1 ]; do @@ -287,6 +290,7 @@ shellspec_get_line() { unset "$1" ||: } +# shellcheck disable=SC2295 shellspec_count_lines() { set -- "$1" "$2" 0 while [ "$2" ]; do @@ -309,6 +313,7 @@ shellspec_padding_() { shellspec_padding_ "$1" "$2" $(($3 - 1)) } +# shellcheck disable=SC2295 shellspec_wrap() { [ ! "$2" ] && eval "$1=" && return 0 case $2 in @@ -348,7 +353,7 @@ else shellspec_readfile() { shellspec_readfile_posix "$@"; } fi -# shellcheck disable=SC2039 +# shellcheck disable=SC3043,SC3044 shellspec_readfile_bash_readarray() { [ -e "$2" ] || { unset "$1" ||:; return 0; } [ -s "$2" ] || { eval "$1=''"; return 0; } @@ -369,14 +374,14 @@ shellspec_readfile_ksh_readall() { return 0 } -# shellcheck disable=SC2039 +# shellcheck disable=SC3045 shellspec_readfile_read_delim() { [ -e "$2" ] || { unset "$1" ||:; return 0; } [ -s "$2" ] || { eval "$1=''"; return 0; } IFS= read -r -d "" "$1" < "$2" ||: } -# shellcheck disable=SC2039 +# shellcheck disable=SC3044 shellspec_readfile_yash_array() { [ -e "$2" ] || { unset "$1" ||:; return 0; } [ -s "$2" ] || { eval "$1=''"; return 0; } @@ -395,19 +400,21 @@ shellspec_readfile_zsh_mapfile() { eval "$1=\"\${mapfile[\$2]}\"" } -# shellcheck disable=SC2039 shellspec_readfile_zsh_concat() { [ -e "$2" ] || { unset "$1" ||:; return 0; } [ -s "$2" ] || { eval "$1=''"; return 0; } + # shellcheck disable=SC3043 local shellspec_readfile_line='' shellspec_readfile_data='' while IFS= read -r shellspec_readfile_line; do + # shellcheck disable=SC3024 shellspec_readfile_data+="${shellspec_readfile_line}${SHELLSPEC_LF}" done < "$2" + # shellcheck disable=SC3024 shellspec_readfile_data+="$shellspec_readfile_line" eval "$1=\"\$shellspec_readfile_data\"" } -# shellcheck disable=SC2039 +# shellcheck disable=SC3043 shellspec_readfile_zsh_array() { [ -e "$2" ] || { unset "$1" ||:; return 0; } [ -s "$2" ] || { eval "$1=''"; return 0; } @@ -758,6 +765,7 @@ else } fi +# shellcheck disable=SC2295 shellspec_which() { set -- "$1" "${PATH%$SHELLSPEC_PATHSEP}${SHELLSPEC_PATHSEP}" while [ "${2%$SHELLSPEC_PATHSEP}" ]; do @@ -784,7 +792,7 @@ shellspec_is_empty_directory() { # workaround for posh 0.10.2: glob does not expand when set -u set +o noglob +u - # shellcheck disable=SC2039 + # shellcheck disable=SC3044 [ "${SHELLSPEC_FAILGLOB_AVAILABLE:-}" ] && shopt -u failglob [ "${SHELLSPEC_NOMATCH_AVAILABLE:-}" ] && setopt NO_NOMATCH @@ -819,7 +827,7 @@ shellspec_unsetf() { return 0 fi if [ "$SHELLSPEC_BUILTIN_TYPESETF" ]; then - # shellcheck disable=SC2039 + # shellcheck disable=SC3044 typeset -f "$1" >/dev/null 2>&1 || return 0 elif [ "${POSH_VERSION:-}" ]; then ( unset -f "$1" 2>/dev/null ) || return 0 diff --git a/lib/libexec/optparser/parser_definition_generated.sh b/lib/libexec/optparser/parser_definition_generated.sh index 9377497c..48f756cc 100644 --- a/lib/libexec/optparser/parser_definition_generated.sh +++ b/lib/libexec/optparser/parser_definition_generated.sh @@ -19,7 +19,7 @@ export SHELLSPEC_ERROR_EXIT_CODE='102' export SHELLSPEC_PROFILER='' export SHELLSPEC_PROFILER_LIMIT='10' export SHELLSPEC_LOGFILE='/dev/tty' -export SHELLSPEC_TMPDIR=${TMPDIR:-${TMP:-/tmp}} +export SHELLSPEC_TMPDIR="${TMPDIR:-${TMP:-/tmp}}" export SHELLSPEC_KEEP_TMPDIR='' export SHELLSPEC_QUICK='' export SHELLSPEC_WORKERS='0' diff --git a/lib/libexec/reporter.sh b/lib/libexec/reporter.sh index 6907da32..7f1e1921 100644 --- a/lib/libexec/reporter.sh +++ b/lib/libexec/reporter.sh @@ -15,6 +15,7 @@ count_examples() { } # $1: prefix, $2: filename +# shellcheck disable=SC2295 read_time_log() { eval "$1_real='' $1_user='' $1_sys=''" [ -r "$2" ] || return 1 @@ -89,6 +90,7 @@ xmlcdata() { fi } +# shellcheck disable=SC2295 remove_escape_sequence() { while IFS= read -r line || [ "$line" ]; do text='' diff --git a/lib/libexec/reporter/documentation_formatter.sh b/lib/libexec/reporter/documentation_formatter.sh index 2a378e24..d991bb63 100644 --- a/lib/libexec/reporter/documentation_formatter.sh +++ b/lib/libexec/reporter/documentation_formatter.sh @@ -7,6 +7,7 @@ create_buffers documentation require_formatters methods conclusion finished summary references profiler [ "$SHELLSPEC_KCOV" ] && require_formatters kcov +# shellcheck disable=SC2295 documentation_each() { _id='' _current_id='' _description='' _indent='' _last_id=$documentation_last_id diff --git a/lib/libexec/reporter/formatter.sh b/lib/libexec/reporter/formatter.sh index a5c2d683..276a51a1 100644 --- a/lib/libexec/reporter/formatter.sh +++ b/lib/libexec/reporter/formatter.sh @@ -15,7 +15,7 @@ load_formatter() { import_formatter "$1" # move main formatter to first - #shellcheck disable=SC2086 + #shellcheck disable=SC2086,SC2295 set -- "$1" ${formatters%$1*} ${formatters#*$1} formatters="$*" } diff --git a/lib/libexec/reporter/junit_formatter.sh b/lib/libexec/reporter/junit_formatter.sh index 72bc48f5..d07f6061 100644 --- a/lib/libexec/reporter/junit_formatter.sh +++ b/lib/libexec/reporter/junit_formatter.sh @@ -82,7 +82,7 @@ junit_each() { inc _errors _errors_total _message="${field_note}${field_note:+: }${field_message}" _failure=$field_failure_message _address="$field_specfile:$field_lineno" - wrap _failure "${_failure%${LF}}${LF}" " " + wrap _failure "${_failure%"$LF"}${LF}" " " _system_error="${_system_error}${_message}${LF}${_failure}" _system_error="${_system_error}# ${_address}${LF}${LF}" ;; diff --git a/lib/libexec/shellspec.sh b/lib/libexec/shellspec.sh index d0217a79..1a12f8d0 100644 --- a/lib/libexec/shellspec.sh +++ b/lib/libexec/shellspec.sh @@ -115,9 +115,11 @@ current_shell() { cmdline=$(read_cmdline "/proc/$2/cmdline") [ "$cmdline" ] || cmdline=$(read_ps "$2") + # shellcheck disable=SC2295 echo "${cmdline%% $self*}" } +# shellcheck disable=SC2295 command_path() { if [ $# -lt 2 ]; then set -- "" "$1" "${PATH}${SHELLSPEC_PATHSEP}" @@ -148,7 +150,7 @@ setup_load_path() { SHELLSPEC_LOAD_PATH="${1}${SHELLSPEC_PATHSEP}${SHELLSPEC_LOAD_PATH}" shift done - SHELLSPEC_LOAD_PATH=${SHELLSPEC_LOAD_PATH%$SHELLSPEC_PATHSEP} + SHELLSPEC_LOAD_PATH=${SHELLSPEC_LOAD_PATH%"$SHELLSPEC_PATHSEP"} } finddirs() { diff --git a/lib/support-bin.sh b/lib/support-bin.sh index 3e6a4863..c7820614 100644 --- a/lib/support-bin.sh +++ b/lib/support-bin.sh @@ -10,7 +10,7 @@ if [ "${SHELLSPEC_PATH_IS_READONLY:-}" ]; then # shellcheck disable=SC2086 exec $SHELLSPEC_SHELL "$0" "$@" fi - # shellcheck disable=SC2039 + # shellcheck disable=SC3044 typeset +x PATH exec "$SHELLSPEC_ENV" PATH="$PATH" SHELLSPEC_PATH_IS_READONLY="" "$0" "$@" fi diff --git a/libexec/shellspec-executor.sh b/libexec/shellspec-executor.sh index e99e76a7..d5fec300 100755 --- a/libexec/shellspec-executor.sh +++ b/libexec/shellspec-executor.sh @@ -39,7 +39,7 @@ error_handler() { detect_unexpected_error "$specfile" "$lineno" "$errors" errors='' fi - line=${line#${SYN}shellspec_marker:} + line=${line#"$SYN"shellspec_marker:} specfile=${line% *} lineno=${line##* } ;; Syntax\ error:*) putsn "${LF}${line}"; error_handler_status=1 ;; diff --git a/libexec/shellspec-inspection.sh b/libexec/shellspec-inspection.sh index 708ebdfc..c458d42a 100755 --- a/libexec/shellspec-inspection.sh +++ b/libexec/shellspec-inspection.sh @@ -80,9 +80,8 @@ fi set -e SHELLSPEC_CLONE_TYPE="posix" -# shellcheck disable=SC2039 +# shellcheck disable=SC3044 if typeset >/dev/null 2>&1; then - # shellcheck disable=SC2034 set -- "$(var=data; typeset -p var 2>/dev/null ||:)" ||: if [ ! "${1#*data}" = "$1" ]; then if [ "${BASH_VERSION:-}" ]; then @@ -116,16 +115,19 @@ if "${0%/*}/shellspec-shebang" 2>/dev/null; then fi set +e -# shellcheck disable=SC2034,SC2039 ( + # shellcheck disable=SC3045 ulimit -t unlimited || exit 1 + # shellcheck disable=SC3047 trap '' DEBUG || exit 1 echo "SHELLSPEC_DEBUG_TRAP=1" echo "SHELLSPEC_KCOV_COMPATIBLE_SHELL=1" # Workaround for ksh93u+ and ksh2020 (fixed in ksh93u+m) + # shellcheck disable=SC3047 trap ':' DEBUG + # shellcheck disable=SC2034 r=$(exit 123) if [ $? -ne 123 ]; then echo "SHELLSPEC_DEFECT_DEBUGXS=1" @@ -161,14 +163,14 @@ if print -nr -- '' 2>/dev/null; then fi typesetf_check() { :; } -# shellcheck disable=SC2034,SC2039 +# shellcheck disable=SC3044 if typeset -f typesetf_check >/dev/null 2>&1; then echo "SHELLSPEC_BUILTIN_TYPESETF=1" fi if type shopt >/dev/null 2>&1; then echo "SHELLSPEC_SHOPT_AVAILABLE=1" - # shellcheck disable=SC2039 + # shellcheck disable=SC3044 if shopt -s failglob 2>/dev/null; then echo "SHELLSPEC_FAILGLOB_AVAILABLE=1" fi @@ -178,18 +180,18 @@ if setopt NO_NOMATCH >/dev/null 2>&1; then echo "SHELLSPEC_NOMATCH_AVAILABLE=1" fi -#shellcheck disable=SC2034,SC2039 +# shellcheck disable=SC2034,SC3022 if ( exec {fd}>/dev/null ) 2>/dev/null; then echo "SHELLSPEC_FDVAR_AVAILABLE=1" fi -# shellcheck disable=SC2039 +# shellcheck disable=SC3044 if readarray /dev/null; then echo "SHELLSPEC_BUILTIN_READARRAY=1" fi string='' -# shellcheck disable=SC2039 +# shellcheck disable=SC3024 if string+="concat" 2>/dev/null; then echo "SHELLSPEC_STRING_CONCAT=1" fi @@ -199,7 +201,7 @@ if ( eval '{ : <#((0)); } <<<:' ) 2>/dev/null; then fi line='' -# shellcheck disable=SC2039 +# shellcheck disable=SC3045 read -r -d "" line <<'HERE' 2>/dev/null ||: a\b HERE diff --git a/libexec/shellspec-prechecker.sh b/libexec/shellspec-prechecker.sh index 96252603..e5f39aa4 100755 --- a/libexec/shellspec-prechecker.sh +++ b/libexec/shellspec-prechecker.sh @@ -3,6 +3,7 @@ set -e +# shellcheck source=lib/libexec/prechecker.sh . "${SHELLSPEC_LIB:-./lib}/libexec/prechecker.sh" warn_fd=2 status_file="" xs='' diff --git a/libexec/shellspec-runner.sh b/libexec/shellspec-runner.sh index eeefc6cd..a3e93fa3 100755 --- a/libexec/shellspec-runner.sh +++ b/libexec/shellspec-runner.sh @@ -1,8 +1,7 @@ #!/bin/sh -#shellcheck disable=SC2004 set -eu -# shellcheck disable=SC2039 +# shellcheck disable=SC3044 shopt -u verbose_errexit 2>/dev/null ||: # shellcheck source=lib/libexec/runner.sh @@ -79,6 +78,7 @@ error_handler() { error_count=0 while IFS= read -r line; do + # shellcheck disable=SC2004 error_count=$(($error_count + 1)) error "$line" done @@ -180,7 +180,7 @@ if [ "$SHELLSPEC_BANNER" ]; then fi if [ "${SHELLSPEC_RANDOM:-}" ]; then - export SHELLSPEC_LIST=$SHELLSPEC_RANDOM + export SHELLSPEC_LIST="$SHELLSPEC_RANDOM" exec="$SHELLSPEC_LIBEXEC/shellspec-list.sh" eval "$SHELLSPEC_SHELL" "\"$exec\"" ${1+'"$@"'} >"$SHELLSPEC_INFILE" set -- - @@ -216,7 +216,7 @@ set +e 0) continue ;; "$SHELLSPEC_FAILURE_EXIT_CODE") [ "$xs" ] || xs=$i ;; "$SHELLSPEC_ERROR_EXIT_CODE") xs=$i error=1 && break ;; - *) [ "${xs#$SHELLSPEC_FAILURE_EXIT_CODE}" ] || xs=$i; error=1 + *) [ "${xs#"$SHELLSPEC_FAILURE_EXIT_CODE"}" ] || xs=$i; error=1 esac done if [ "$error" ]; then diff --git a/libexec/shellspec-unreadonly-path.sh b/libexec/shellspec-unreadonly-path.sh index eae199da..a8b4785e 100755 --- a/libexec/shellspec-unreadonly-path.sh +++ b/libexec/shellspec-unreadonly-path.sh @@ -1,4 +1,4 @@ #!/bin/sh -eu -# shellcheck disable=SC2039 +# shellcheck disable=SC3044 typeset +x PATH exec "$SHELLSPEC_ENV" PATH="$PATH" SHELLSPEC_PATH_IS_READONLY='' "$SHELLSPEC_SHELL" "$@" diff --git a/shellspec b/shellspec index 2b89c58c..8d80a7d6 100755 --- a/shellspec +++ b/shellspec @@ -5,7 +5,7 @@ set -e -u -f -#shellcheck disable=SC2039 +#shellcheck disable=SC3044 [ "${OIL_VERSION:-}" ] && shopt -s compat_array if [ "${1:-}" = "-" ]; then @@ -22,7 +22,7 @@ if [ "${1:-}" = "-" ]; then fi export SHELLSPEC_VERSION='0.29.0-dev' -export SHELLSPEC_CWD=$PWD +export SHELLSPEC_CWD="$PWD" export SHELLSPEC_PATH='' export SHELLSPEC_GRAMMAR_DSLS='' export SHELLSPEC_GRAMMAR_DIRECTIVES='' @@ -89,7 +89,7 @@ export SHELLSPEC_SORT="sort" export SHELLSPEC_FIND="find" #shellcheck disable=SC2039,SC3028 -export SHELLSPEC_HOSTNAME=${HOSTNAME:-localhost} +export SHELLSPEC_HOSTNAME="${HOSTNAME:-localhost}" export SHELLSPEC_COLOR='' if [ ! "${NO_COLOR:-}" ] && { [ -t 1 ] || [ "${FORCE_COLOR:-}" ]; } then diff --git a/spec/bootstrap_spec.sh b/spec/bootstrap_spec.sh index 2be802d0..5fb90296 100644 --- a/spec/bootstrap_spec.sh +++ b/spec/bootstrap_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % SIGNAL: "$SHELLSPEC_TMPBASE/profiler.test" diff --git a/spec/core/clone_spec.sh b/spec/core/clone_spec.sh index 2175f65c..9565cf8e 100644 --- a/spec/core/clone_spec.sh +++ b/spec/core/clone_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2004,SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/clone.sh" Include "$SHELLSPEC_LIB/core/clone.sh" @@ -96,7 +96,7 @@ Describe "core/clone.sh" End BeforeCall 'var=$(var1)' - shellspec_clone_typeset() { %= "$var"; } + shellspec_clone_typeset() { %putsn "$var"; } [ "$SHELLSPEC_BUILTIN_PRINT" ] || eval 'print() { printf "%s\n" "$3"; }' Describe "shellspec_clone_posix()" @@ -494,9 +494,9 @@ Describe "core/clone.sh" shellspec_clone_typeset() { # shellcheck disable=SC2154 if [ "$1" = "+" ]; then - %= "$vars" + %putsn "$vars" elif [ "$1" = "-g" ]; then - %= "$var" + %putsn "$var" fi } @@ -752,10 +752,10 @@ Describe "core/clone.sh" BeforeCall 'vars=$(vars)' shellspec_clone_typeset() { - %= "$vars" + %putsn "$vars" } shellspec_clone_set() { - %= "$var" + %putsn "$var" } Specify 'var=123' @@ -832,10 +832,10 @@ Describe "core/clone.sh" BeforeCall 'vars=$(vars)' shellspec_clone_typeset() { - %= "$vars" + %putsn "$vars" } shellspec_clone_set() { - %= "$var" + %putsn "$var" } Specify 'var=123' diff --git a/spec/core/dsl/assert_spec.sh b/spec/core/dsl/assert_spec.sh index ca21ae5a..9fd82f3b 100644 --- a/spec/core/dsl/assert_spec.sh +++ b/spec/core/dsl/assert_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe 'Assert' custom_assertion() { diff --git a/spec/core/dsl/before_after_all_spec.sh b/spec/core/dsl/before_after_all_spec.sh index a514b59f..a4e8c944 100644 --- a/spec/core/dsl/before_after_all_spec.sh +++ b/spec/core/dsl/before_after_all_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % MARK_FILE: "$SHELLSPEC_TMPBASE/before_after_each_all" diff --git a/spec/core/dsl/before_after_each_spec.sh b/spec/core/dsl/before_after_each_spec.sh index 4ad03173..92fa3337 100644 --- a/spec/core/dsl/before_after_each_spec.sh +++ b/spec/core/dsl/before_after_each_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % MARK_FILE: "$SHELLSPEC_TMPBASE/before_after_each_hook" diff --git a/spec/core/dsl/data_spec.sh b/spec/core/dsl/data_spec.sh index 2d194b24..efe603d3 100644 --- a/spec/core/dsl/data_spec.sh +++ b/spec/core/dsl/data_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" diff --git a/spec/core/dsl/directives_spec.sh b/spec/core/dsl/directives_spec.sh index 3798d470..fc68956a 100644 --- a/spec/core/dsl/directives_spec.sh +++ b/spec/core/dsl/directives_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe 'Directives' Describe '%puts' @@ -19,6 +19,7 @@ Describe 'Directives' End Describe '%putsn' + # shellcheck disable=SC2276 _putsn() { %= "$@"; } _putsn_long() { %putsn "$@" diff --git a/spec/core/dsl/include_spec.sh b/spec/core/dsl/include_spec.sh index 1aa73319..3b1107b1 100644 --- a/spec/core/dsl/include_spec.sh +++ b/spec/core/dsl/include_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" diff --git a/spec/core/dsl/mock_spec.sh b/spec/core/dsl/mock_spec.sh index 58d21dd5..bf0e46a8 100644 --- a/spec/core/dsl/mock_spec.sh +++ b/spec/core/dsl/mock_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Skip if "tmp directory is not executable" noexec_tmpdir @@ -51,7 +51,7 @@ Describe 'Mock helper' End Mock mocked-command - %= foo + %putsn foo # shellcheck disable=SC2034 var=123 %preserve var diff --git a/spec/core/dsl/parameters_spec.sh b/spec/core/dsl/parameters_spec.sh index fc527ec7..d531d7c4 100644 --- a/spec/core/dsl/parameters_spec.sh +++ b/spec/core/dsl/parameters_spec.sh @@ -1,8 +1,8 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe 'Parameters helper' desc() { - echo "${SHELLSPEC_DESCRIPTION##*$SHELLSPEC_VT}" + echo "${SHELLSPEC_DESCRIPTION##*"$SHELLSPEC_VT"}" } Describe 'block style' diff --git a/spec/core/dsl/text_spec.sh b/spec/core/dsl/text_spec.sh index 582a37ad..1aa7433c 100644 --- a/spec/core/dsl/text_spec.sh +++ b/spec/core/dsl/text_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016,SC2021 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe '%text' It 'outputs to stdout' diff --git a/spec/core/dsl_spec.sh b/spec/core/dsl_spec.sh index 1c8a189e..8a211539 100644 --- a/spec/core/dsl_spec.sh +++ b/spec/core/dsl_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2004,SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" % LIB: "$SHELLSPEC_HELPERDIR/fixture/lib" diff --git a/spec/core/evaluation_spec.sh b/spec/core/evaluation_spec.sh index fe581513..cd06eac0 100644 --- a/spec/core/evaluation_spec.sh +++ b/spec/core/evaluation_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % BIN: "$SHELLSPEC_HELPERDIR/fixture/bin" % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" diff --git a/spec/core/file_descriptor_spec.sh b/spec/core/file_descriptor_spec.sh index 6889afcb..4b7c2e49 100644 --- a/spec/core/file_descriptor_spec.sh +++ b/spec/core/file_descriptor_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2004,SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/file_descriptor.sh" Describe "shellspec_enum_file_descriptors()" diff --git a/spec/core/hook_spec.sh b/spec/core/hook_spec.sh index 733cb9c8..715860b7 100644 --- a/spec/core/hook_spec.sh +++ b/spec/core/hook_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/hook.sh" Before 'shellspec_create_hook EXAMPLE' diff --git a/spec/core/matchers/be/empty_spec.sh b/spec/core/matchers/be/empty_spec.sh index f72b88aa..a6a1a563 100644 --- a/spec/core/matchers/be/empty_spec.sh +++ b/spec/core/matchers/be/empty_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" % EMPTYDIR: "$SHELLSPEC_TMPBASE/emptydir" diff --git a/spec/core/matchers/be/stat_spec.sh b/spec/core/matchers/be/stat_spec.sh index 029a3312..8f791430 100644 --- a/spec/core/matchers/be/stat_spec.sh +++ b/spec/core/matchers/be/stat_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" diff --git a/spec/core/matchers/be/status_spec.sh b/spec/core/matchers/be/status_spec.sh index 6b297370..feb05b53 100644 --- a/spec/core/matchers/be/status_spec.sh +++ b/spec/core/matchers/be/status_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/matchers/be/status.sh" BeforeRun set_subject matcher_mock diff --git a/spec/core/matchers/be/valid_spec.sh b/spec/core/matchers/be/valid_spec.sh index b4b238d8..e3c32e60 100644 --- a/spec/core/matchers/be/valid_spec.sh +++ b/spec/core/matchers/be/valid_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/matchers/be/valid.sh" BeforeRun set_subject matcher_mock diff --git a/spec/core/matchers/be/variable_spec.sh b/spec/core/matchers/be/variable_spec.sh index e8a59169..9cb305da 100644 --- a/spec/core/matchers/be/variable_spec.sh +++ b/spec/core/matchers/be/variable_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/matchers/be/variable.sh" BeforeRun set_subject matcher_mock diff --git a/spec/core/matchers/end_with_spec.sh b/spec/core/matchers/end_with_spec.sh index b6223732..447953fa 100644 --- a/spec/core/matchers/end_with_spec.sh +++ b/spec/core/matchers/end_with_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/matchers/end_with.sh" BeforeRun set_subject matcher_mock diff --git a/spec/core/matchers/equal_spec.sh b/spec/core/matchers/equal_spec.sh index 5d9e0803..47b26b1d 100644 --- a/spec/core/matchers/equal_spec.sh +++ b/spec/core/matchers/equal_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/matchers/eq.sh" BeforeRun set_subject matcher_mock diff --git a/spec/core/matchers/have/stat_spec.sh b/spec/core/matchers/have/stat_spec.sh index 03da9825..87022519 100644 --- a/spec/core/matchers/have/stat_spec.sh +++ b/spec/core/matchers/have/stat_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" diff --git a/spec/core/matchers/include_spec.sh b/spec/core/matchers/include_spec.sh index 496ff2f4..dbe43907 100644 --- a/spec/core/matchers/include_spec.sh +++ b/spec/core/matchers/include_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/matchers/include.sh" BeforeRun set_subject matcher_mock diff --git a/spec/core/matchers/match_spec.sh b/spec/core/matchers/match_spec.sh index d2c2fdd8..7e3353ee 100644 --- a/spec/core/matchers/match_spec.sh +++ b/spec/core/matchers/match_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/matchers/match.sh" BeforeRun set_subject matcher_mock diff --git a/spec/core/matchers/satisfy_spec.sh b/spec/core/matchers/satisfy_spec.sh index 4386bee8..f00ed182 100644 --- a/spec/core/matchers/satisfy_spec.sh +++ b/spec/core/matchers/satisfy_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/matchers/satisfy.sh" BeforeRun set_subject matcher_mock diff --git a/spec/core/matchers/start_with_spec.sh b/spec/core/matchers/start_with_spec.sh index 3ab6f7c5..11710747 100644 --- a/spec/core/matchers/start_with_spec.sh +++ b/spec/core/matchers/start_with_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/matchers/start_with.sh" BeforeRun set_subject matcher_mock diff --git a/spec/core/matchers_spec.sh b/spec/core/matchers_spec.sh index 5dfd10c5..26f74a21 100644 --- a/spec/core/matchers_spec.sh +++ b/spec/core/matchers_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/matchers.sh" Include "$SHELLSPEC_LIB/core/matchers.sh" diff --git a/spec/core/modifiers/contents_spec.sh b/spec/core/modifiers/contents_spec.sh index 4e5fc7fc..fd8d223f 100644 --- a/spec/core/modifiers/contents_spec.sh +++ b/spec/core/modifiers/contents_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % FILE: "$SHELLSPEC_HELPERDIR/fixture/end-with-multiple-lf.txt" diff --git a/spec/core/modifiers/length_spec.sh b/spec/core/modifiers/length_spec.sh index acf8eabd..e8d6d08c 100644 --- a/spec/core/modifiers/length_spec.sh +++ b/spec/core/modifiers/length_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/modifiers/length.sh" BeforeRun set_subject modifier_mock diff --git a/spec/core/modifiers/line_spec.sh b/spec/core/modifiers/line_spec.sh index 200f6db6..86572757 100644 --- a/spec/core/modifiers/line_spec.sh +++ b/spec/core/modifiers/line_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/modifiers/line.sh" BeforeRun set_subject modifier_mock diff --git a/spec/core/modifiers/lines_spec.sh b/spec/core/modifiers/lines_spec.sh index c0cdbf14..b461c5c7 100644 --- a/spec/core/modifiers/lines_spec.sh +++ b/spec/core/modifiers/lines_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/modifiers/lines.sh" BeforeRun set_subject modifier_mock diff --git a/spec/core/modifiers/result_spec.sh b/spec/core/modifiers/result_spec.sh index 4e53fcfc..b8f0c9d1 100644 --- a/spec/core/modifiers/result_spec.sh +++ b/spec/core/modifiers/result_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/modifiers/result.sh" BeforeRun set_subject modifier_mock diff --git a/spec/core/modifiers/word_spec.sh b/spec/core/modifiers/word_spec.sh index 3466972b..807be06a 100644 --- a/spec/core/modifiers/word_spec.sh +++ b/spec/core/modifiers/word_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/modifiers/word.sh" BeforeRun set_subject modifier_mock diff --git a/spec/core/output_spec.sh b/spec/core/output_spec.sh index 0acf24f9..edb9d370 100644 --- a/spec/core/output_spec.sh +++ b/spec/core/output_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/output.sh" Include "$SHELLSPEC_LIB/core/output.sh" diff --git a/spec/core/outputs_spec.sh b/spec/core/outputs_spec.sh index bb03d758..453120a0 100644 --- a/spec/core/outputs_spec.sh +++ b/spec/core/outputs_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/outputs.sh" Include "$SHELLSPEC_LIB/core/outputs.sh" diff --git a/spec/core/statement_spec.sh b/spec/core/statement_spec.sh index 92c53831..2bf7d6a5 100644 --- a/spec/core/statement_spec.sh +++ b/spec/core/statement_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/statement.sh" Include "$SHELLSPEC_LIB/core/statement.sh" diff --git a/spec/core/subjects/fd_spec.sh b/spec/core/subjects/fd_spec.sh index 41030b61..39bbc1cf 100644 --- a/spec/core/subjects/fd_spec.sh +++ b/spec/core/subjects/fd_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/subjects/fd.sh" BeforeRun 'set_fd 5' subject_mock @@ -16,7 +16,7 @@ Describe "core/subjects/fd.sh" UseFD FD Example 'example' - # shellcheck disable=SC2039 + # shellcheck disable=SC3021 foo() { echo "foo" >&"$FD"; } When call foo The fd FD should equal "foo" diff --git a/spec/core/subjects/line_spec.sh b/spec/core/subjects/line_spec.sh index bc05014a..86156abe 100644 --- a/spec/core/subjects/line_spec.sh +++ b/spec/core/subjects/line_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/subjects/line.sh" BeforeRun set_stdout subject_mock diff --git a/spec/core/subjects/path_spec.sh b/spec/core/subjects/path_spec.sh index b325328f..f095f5fd 100644 --- a/spec/core/subjects/path_spec.sh +++ b/spec/core/subjects/path_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/subjects/path.sh" BeforeRun subject_mock diff --git a/spec/core/subjects/status_spec.sh b/spec/core/subjects/status_spec.sh index 83ddf3d3..373b7f28 100644 --- a/spec/core/subjects/status_spec.sh +++ b/spec/core/subjects/status_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/subjects/status.sh" BeforeRun set_status subject_mock diff --git a/spec/core/subjects/stderr_spec.sh b/spec/core/subjects/stderr_spec.sh index 6894845b..76143bdc 100644 --- a/spec/core/subjects/stderr_spec.sh +++ b/spec/core/subjects/stderr_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/subjects/stderr.sh" mock() { diff --git a/spec/core/subjects/stdout_spec.sh b/spec/core/subjects/stdout_spec.sh index 87cce995..319a27b1 100644 --- a/spec/core/subjects/stdout_spec.sh +++ b/spec/core/subjects/stdout_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/subjects/stdout.sh" mock() { diff --git a/spec/core/subjects/value_spec.sh b/spec/core/subjects/value_spec.sh index f2a0dc73..47bfe55b 100644 --- a/spec/core/subjects/value_spec.sh +++ b/spec/core/subjects/value_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/subjects/value.sh" BeforeRun subject_mock diff --git a/spec/core/subjects/variable_spec.array.sh b/spec/core/subjects/variable_spec.array.sh index 17a4bace..1fd9278a 100644 --- a/spec/core/subjects/variable_spec.array.sh +++ b/spec/core/subjects/variable_spec.array.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 # NOTE # diff --git a/spec/core/subjects/variable_spec.sh b/spec/core/subjects/variable_spec.sh index 600fb1e8..4d1c4e2d 100644 --- a/spec/core/subjects/variable_spec.sh +++ b/spec/core/subjects/variable_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/subjects/variable.sh" BeforeRun subject_mock diff --git a/spec/core/subjects/word_spec.sh b/spec/core/subjects/word_spec.sh index 8296c5c0..1b7ce7c0 100644 --- a/spec/core/subjects/word_spec.sh +++ b/spec/core/subjects/word_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/subjects/word.sh" BeforeRun set_stdout subject_mock diff --git a/spec/core/subjects_spec.sh b/spec/core/subjects_spec.sh index fbef2af9..f91bde2d 100644 --- a/spec/core/subjects_spec.sh +++ b/spec/core/subjects_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/subjects.sh" End diff --git a/spec/core/switch_spec.sh b/spec/core/switch_spec.sh index ac39c6e7..595b5cc8 100644 --- a/spec/core/switch_spec.sh +++ b/spec/core/switch_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/switch.sh" Describe 'shellspec_on()' diff --git a/spec/core/syntax_spec.sh b/spec/core/syntax_spec.sh index e633570d..b65d43f2 100644 --- a/spec/core/syntax_spec.sh +++ b/spec/core/syntax_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/syntax.sh" Include "$SHELLSPEC_LIB/core/syntax.sh" diff --git a/spec/core/utils_spec.sh b/spec/core/utils_spec.sh index c84b96b1..731815e9 100644 --- a/spec/core/utils_spec.sh +++ b/spec/core/utils_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/utils.sh" Include "$SHELLSPEC_LIB/core/utils.sh" @@ -96,7 +96,7 @@ Describe "core/utils.sh" Describe 'shellspec_set_option()' BeforeRun 'SHELLSPEC_SHELL_OPTIONS="set -o foo;set +o bar;"' - shellspec_set_long() { %= "$@"; } + shellspec_set_long() { %putsn "$@"; } It 'sets long options' When run shellspec_set_option diff --git a/spec/core/verb_spec.sh b/spec/core/verb_spec.sh index e1507b60..4c6b0bdc 100644 --- a/spec/core/verb_spec.sh +++ b/spec/core/verb_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "core/verb.sh" mock() { diff --git a/spec/cov/kcov_spec.sh b/spec/cov/kcov_spec.sh index 4a52f313..1b10ed09 100644 --- a/spec/cov/kcov_spec.sh +++ b/spec/cov/kcov_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe 'cov/kcov.sh' Describe 'shellspec_coverage_setup()' diff --git a/spec/general_spec.sh b/spec/general_spec.sh index 006e96e8..f66fcd89 100644 --- a/spec/general_spec.sh +++ b/spec/general_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % BIN: "$SHELLSPEC_HELPERDIR/fixture/bin" % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" diff --git a/spec/getoptions_abbr_spec.sh b/spec/getoptions_abbr_spec.sh index 9b4ea947..3bb9c4f6 100644 --- a/spec/getoptions_abbr_spec.sh +++ b/spec/getoptions_abbr_spec.sh @@ -1,4 +1,4 @@ -# shellcheck shell=sh disable=SC1083,SC2004,SC2016 +# shellcheck shell=sh disable=SC1083,SC2016,SC2286,SC2287,SC2288 Describe "getoptions_abbr()" Include ./lib/getoptions.sh diff --git a/spec/getoptions_help_spec.sh b/spec/getoptions_help_spec.sh index a1550964..9d4c3759 100644 --- a/spec/getoptions_help_spec.sh +++ b/spec/getoptions_help_spec.sh @@ -1,4 +1,4 @@ -# shellcheck shell=sh disable=SC1083,SC2004,SC2016 +# shellcheck shell=sh disable=SC1083,SC2016,SC2286,SC2287,SC2288 Describe "getoptions_help()" Include ./lib/getoptions_help.sh diff --git a/spec/getoptions_spec.sh b/spec/getoptions_spec.sh index f3c5d315..3e06ee10 100644 --- a/spec/getoptions_spec.sh +++ b/spec/getoptions_spec.sh @@ -1,4 +1,4 @@ -# shellcheck shell=sh disable=SC1083,SC2004,SC2016 +# shellcheck shell=sh disable=SC1083,SC2016,SC2286,SC2287,SC2288 Describe "getoptions()" Include ./lib/getoptions.sh diff --git a/spec/install_spec.sh b/spec/install_spec.sh index 48c6ffa1..034ad30c 100644 --- a/spec/install_spec.sh +++ b/spec/install_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % BIN: "$SHELLSPEC_HELPERDIR/fixture/bin" % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture/install" diff --git a/spec/libexec/binary_spec.sh b/spec/libexec/binary_spec.sh index a0433ce6..138ef95a 100644 --- a/spec/libexec/binary_spec.sh +++ b/spec/libexec/binary_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "libexec/binary.sh" Include "$SHELLSPEC_LIB/libexec/binary.sh" diff --git a/spec/libexec/executor_spec.sh b/spec/libexec/executor_spec.sh index c7b37d15..59a2b66c 100644 --- a/spec/libexec/executor_spec.sh +++ b/spec/libexec/executor_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "libexec/executor.sh" Include "$SHELLSPEC_LIB/libexec/executor.sh" diff --git a/spec/libexec/grammar_spec.sh b/spec/libexec/grammar_spec.sh index 815e7d84..51895585 100644 --- a/spec/libexec/grammar_spec.sh +++ b/spec/libexec/grammar_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "libexec/grammar.sh" # shellcheck disable=SC2034 diff --git a/spec/libexec/kcov-executor_spec.sh b/spec/libexec/kcov-executor_spec.sh index f9ecfecf..8c069a12 100644 --- a/spec/libexec/kcov-executor_spec.sh +++ b/spec/libexec/kcov-executor_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "libexec/kcov-executor.sh" Include "$SHELLSPEC_LIB/libexec/kcov-executor.sh" diff --git a/spec/libexec/list_spec.sh b/spec/libexec/list_spec.sh index 17e402e0..f9880e64 100644 --- a/spec/libexec/list_spec.sh +++ b/spec/libexec/list_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "libexec/list.sh" Include "$SHELLSPEC_LIB/libexec/list.sh" diff --git a/spec/libexec/optparser/optparser_spec.sh b/spec/libexec/optparser/optparser_spec.sh index ae9c492b..9aca52ac 100644 --- a/spec/libexec/optparser/optparser_spec.sh +++ b/spec/libexec/optparser/optparser_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "libexec/optparser/optparser.sh" Include "$SHELLSPEC_LIB/libexec/optparser/optparser.sh" diff --git a/spec/libexec/optparser/parser_definition_spec.sh b/spec/libexec/optparser/parser_definition_spec.sh index df124a51..1bb582cd 100644 --- a/spec/libexec/optparser/parser_definition_spec.sh +++ b/spec/libexec/optparser/parser_definition_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "libexec/optparser/parser_definition.sh" Include "$SHELLSPEC_LIB/getoptions.sh" diff --git a/spec/libexec/prechecker_spec.sh b/spec/libexec/prechecker_spec.sh index 21fc8c5d..4646f879 100644 --- a/spec/libexec/prechecker_spec.sh +++ b/spec/libexec/prechecker_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "libexec/prechecker.sh" Include "$SHELLSPEC_LIB/libexec/prechecker.sh" diff --git a/spec/libexec/reporter_spec.sh b/spec/libexec/reporter_spec.sh index 81a3daab..36d00a25 100644 --- a/spec/libexec/reporter_spec.sh +++ b/spec/libexec/reporter_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2004,SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % FILE: "$SHELLSPEC_HELPERDIR/fixture/time_log.txt" % PROFILER_LOG: "$SHELLSPEC_HELPERDIR/fixture/profiler/profiler.log" @@ -441,6 +441,7 @@ Describe "libexec/reporter.sh" callback() { echo "$prefix_field1 $prefix_field2 $prefix_field3" ":" "$@" + # shellcheck disable=SC2004 count=$(($count + 1)) } diff --git a/spec/libexec/runner_spec.sh b/spec/libexec/runner_spec.sh index f9488cfd..20e0d921 100644 --- a/spec/libexec/runner_spec.sh +++ b/spec/libexec/runner_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2004 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" diff --git a/spec/libexec/shellspec_spec.sh b/spec/libexec/shellspec_spec.sh index 2348dd5b..e67522cc 100644 --- a/spec/libexec/shellspec_spec.sh +++ b/spec/libexec/shellspec_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2004,SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % BIN: "$SHELLSPEC_HELPERDIR/fixture/bin" % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture/" @@ -437,6 +437,7 @@ Describe "libexec/shellspec.sh" callback() { if [ ! "$2" ] || [ -e "$1" ]; then echo "$1 ($2)" + # shellcheck disable=SC2004 count=$(($count+1)) fi } diff --git a/spec/libexec/task_spec.sh b/spec/libexec/task_spec.sh index 8e4747fb..b6a68b2b 100644 --- a/spec/libexec/task_spec.sh +++ b/spec/libexec/task_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "libexec/binary.sh" Include "$SHELLSPEC_LIB/libexec/task.sh" diff --git a/spec/libexec/translator_spec.sh b/spec/libexec/translator_spec.sh index bc902914..9411f844 100644 --- a/spec/libexec/translator_spec.sh +++ b/spec/libexec/translator_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" diff --git a/spec/libexec_spec.sh b/spec/libexec_spec.sh index 92d5596c..7fb08278 100644 --- a/spec/libexec_spec.sh +++ b/spec/libexec_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016,SC2004 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" % INFILE: "$SHELLSPEC_HELPERDIR/fixture/infile" diff --git a/spec/semver_spec.sh b/spec/semver_spec.sh index 87b89609..41ae49e4 100644 --- a/spec/semver_spec.sh +++ b/spec/semver_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "semver.sh" Include "$SHELLSPEC_LIB/semver.sh" diff --git a/spec/shellspec-gen-bin_spec.sh b/spec/shellspec-gen-bin_spec.sh index b3df8023..f5418501 100644 --- a/spec/shellspec-gen-bin_spec.sh +++ b/spec/shellspec-gen-bin_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % GENBIN: "$SHELLSPEC_TMPBASE/gen-bin" % HELPERDIR: "$SHELLSPEC_TMPBASE/gen-bin/spec" diff --git a/spec/shellspec-init_spec.sh b/spec/shellspec-init_spec.sh index 0777ae1f..c9357282 100644 --- a/spec/shellspec-init_spec.sh +++ b/spec/shellspec-init_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" diff --git a/spec/shellspec-inspection_spec.sh b/spec/shellspec-inspection_spec.sh index 7125ba79..e746ce8e 100644 --- a/spec/shellspec-inspection_spec.sh +++ b/spec/shellspec-inspection_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "shellspec-inspection.sh" It "inspects shell capabilities" diff --git a/spec/shellspec-load-env_spec.sh b/spec/shellspec-load-env_spec.sh index e0f116ec..04b3fd85 100644 --- a/spec/shellspec-load-env_spec.sh +++ b/spec/shellspec-load-env_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" diff --git a/spec/shellspec-prechecker_spec.sh b/spec/shellspec-prechecker_spec.sh index cef596ac..0bf3320b 100644 --- a/spec/shellspec-prechecker_spec.sh +++ b/spec/shellspec-prechecker_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 % FIXTURE: "$SHELLSPEC_HELPERDIR/fixture" % FILE: "$SHELLSPEC_TMPBASE/status" diff --git a/spec/shellspec-task_spec.sh b/spec/shellspec-task_spec.sh index e3e4696e..3c8e8f66 100644 --- a/spec/shellspec-task_spec.sh +++ b/spec/shellspec-task_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh disable=SC2016 +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe "shellspec-task.sh" It "lists tasks" diff --git a/spec/support-bin_spec.sh b/spec/support-bin_spec.sh index 67193a55..19d081ca 100644 --- a/spec/support-bin_spec.sh +++ b/spec/support-bin_spec.sh @@ -1,4 +1,4 @@ -#shellcheck shell=sh +# shellcheck shell=sh disable=SC2016,SC2286,SC2287,SC2288 Describe 'support-bin.sh' It 'executes external command'