From: Anders F Björklund Date: Mon, 11 Jun 2018 18:34:35 +0000 (+0200) Subject: Avoid some shellcheck excludes that do make sense X-Git-Tag: v3.5~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85fe19e5e2e4b3942ab989d2e9f0f14066656e38;p=thirdparty%2Fccache.git Avoid some shellcheck excludes that do make sense --- diff --git a/misc/shellcheck-excludes.txt b/misc/shellcheck-excludes.txt index 9c6aad62b..08d8fbd1f 100644 --- a/misc/shellcheck-excludes.txt +++ b/misc/shellcheck-excludes.txt @@ -4,7 +4,5 @@ SC2001: See if you can use ${variable//search/replace} instead. SC2006: Use $(..) instead of legacy `..`. SC2046: Quote this to prevent word splitting. SC2086: Double quote to prevent globbing and word splitting. -SC2094: Make sure not to read and write the same file in the same pipeline. SC2103: Consider using ( subshell ), 'cd foo||exit', or pushd/popd instead. -SC2155: Declare and assign separately to avoid masking return values. SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects. diff --git a/test/suites/base.bash b/test/suites/base.bash index 307100e84..f2c6cb8d1 100644 --- a/test/suites/base.bash +++ b/test/suites/base.bash @@ -298,8 +298,8 @@ base_tests() { # ------------------------------------------------------------------------- TEST "CCACHE_EXTRAFILES" - echo a >a - echo b >b + echo "a" >a + echo "b" >b $CCACHE_COMPILE -c test1.c expect_stat 'cache hit (preprocessed)' 0 diff --git a/test/suites/hardlink.bash b/test/suites/hardlink.bash index 8e7e8b0d5..f4f969e3c 100644 --- a/test/suites/hardlink.bash +++ b/test/suites/hardlink.bash @@ -25,7 +25,8 @@ SUITE_hardlink() { expect_stat 'files in cache' 1 expect_equal_object_files reference_test1.o test1.o - local obj_in_cache=$(find $CCACHE_DIR -name '*.o') + local obj_in_cache + obj_in_cache=$(find $CCACHE_DIR -name '*.o') if [ ! $obj_in_cache -ef test1.o ]; then test_failed "Object file not hard-linked to cached object file" fi diff --git a/test/suites/masquerading.bash b/test/suites/masquerading.bash index 0b42eef34..fbbb78f27 100644 --- a/test/suites/masquerading.bash +++ b/test/suites/masquerading.bash @@ -1,13 +1,16 @@ SUITE_masquerading_PROBE() { - local compiler_binary=$(echo $COMPILER | cut -d' ' -f1) + local compiler_binary + compiler_binary=$(echo $COMPILER | cut -d' ' -f1) if [ "$(dirname $compiler_binary)" != . ]; then echo "compiler ($compiler_binary) not taken from PATH" fi } SUITE_masquerading_SETUP() { - local compiler_binary=$(echo $COMPILER | cut -d' ' -f1) - local compiler_args=$(echo $COMPILER | cut -s -d' ' -f2-) + local compiler_binary + compiler_binary=$(echo $COMPILER | cut -d' ' -f1) + local compiler_args + compiler_args=$(echo $COMPILER | cut -s -d' ' -f2-) ln -s "$CCACHE" $compiler_binary CCACHE_COMPILE="./$compiler_binary $compiler_args"