From 3a6a0acf9a29a9d281650ddcfe93f97756b1e602 Mon Sep 17 00:00:00 2001 From: Benjamin Bannier Date: Mon, 7 Aug 2023 13:07:14 +0200 Subject: [PATCH] Bump pre-commit hooks. --- .pre-commit-config.yaml | 10 +++---- btest-diff | 42 ++++++++++++++-------------- testing/Scripts/convert-path-list.sh | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 43908beb..83887f8e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/shellcheck-py/shellcheck-py - rev: v0.8.0.4 + rev: v0.9.0.5 hooks: - id: shellcheck exclude: examples/|testing/tests/.*\.sh @@ -15,7 +15,7 @@ repos: args: ["-w", "-i", "4", "-ci"] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: trailing-whitespace exclude: ^testing/Baseline @@ -23,18 +23,18 @@ repos: exclude: ^testing/Baseline|examples/.*Baseline.* - repo: https://github.com/psf/black - rev: 23.1a1 + rev: 23.7.0 hooks: - id: black - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.10.1 hooks: - id: pyupgrade args: ["--py37-plus"] - repo: https://github.com/pycqa/flake8 - rev: 5.0.4 # 6.0.0 requires Python 3.8 + rev: 6.1.0 # 6.0.0 requires Python 3.8 hooks: - id: flake8 diff --git a/btest-diff b/btest-diff index 0d4d93c9..4113b417 100755 --- a/btest-diff +++ b/btest-diff @@ -126,7 +126,7 @@ if [ "$TEST_DIAGNOSTICS" = "" ]; then fi if [ "$#" -lt 1 ]; then - echo "btest-diff: wrong number of arguments" >$TEST_DIAGNOSTICS + echo "btest-diff: wrong number of arguments" >"$TEST_DIAGNOSTICS" exit 1 fi @@ -143,13 +143,13 @@ canon=$(echo "$input" | sed 's#/#.#g') shift if [ ! -f "$input" ]; then - echo "btest-diff: input $input does not exist." >$TEST_DIAGNOSTICS + echo "btest-diff: input $input does not exist." >"$TEST_DIAGNOSTICS" exit 1 fi tmpfiles="" delete_tmps() { - # shellcheck disable=SC2086 + # shellcheck disable=SC2086,SC2317 rm -f $tmpfiles 2>/dev/null } @@ -163,20 +163,20 @@ done result=2 -rm -f $TEST_DIAGNOSTICS 2>/dev/null +rm -f "$TEST_DIAGNOSTICS" 2>/dev/null -echo "== File ===============================" >>$TEST_DIAGNOSTICS +echo "== File ===============================" >>"$TEST_DIAGNOSTICS" if [ -z "$baseline" ]; then - cat "$input" >>$TEST_DIAGNOSTICS + cat "$input" >>"$TEST_DIAGNOSTICS" elif [ -n "$TEST_DIFF_BRIEF" ]; then - echo "" >>$TEST_DIAGNOSTICS + echo "" >>"$TEST_DIAGNOSTICS" else if [ "$(wc -l "$input" | awk '{print $1}')" -le "$MAX_LINES" ]; then - cat "$input" >>$TEST_DIAGNOSTICS + cat "$input" >>"$TEST_DIAGNOSTICS" else - head -n "$MAX_LINES" "$input" >>$TEST_DIAGNOSTICS - echo "[... File too long, truncated ...]" >>$TEST_DIAGNOSTICS + head -n "$MAX_LINES" "$input" >>"$TEST_DIAGNOSTICS" + echo "[... File too long, truncated ...]" >>"$TEST_DIAGNOSTICS" fi fi @@ -194,8 +194,8 @@ error=0 # shellcheck disable=SC2094 eval "$TEST_DIFF_CANONIFIER" "$input" <"$input" >"$canon_output" if [ $? -ne 0 ]; then - echo "== Error ==============================" >>$TEST_DIAGNOSTICS - echo "btest-diff: TEST_DIFF_CANONIFIER failed on file '$input'" >>$TEST_DIAGNOSTICS + echo "== Error ==============================" >>"$TEST_DIAGNOSTICS" + echo "btest-diff: TEST_DIFF_CANONIFIER failed on file '$input'" >>"$TEST_DIAGNOSTICS" error=1 result=1 fi @@ -213,32 +213,32 @@ if [ -n "$baseline" ]; then # shellcheck disable=SC2094 eval "$TEST_DIFF_CANONIFIER" "$baseline" <"$baseline" >"$canon_baseline" if [ $? -ne 0 ]; then - echo "== Error ==============================" >>$TEST_DIAGNOSTICS - echo "btest-diff: TEST_DIFF_CANONIFIER failed on file '$baseline'" >>$TEST_DIAGNOSTICS + echo "== Error ==============================" >>"$TEST_DIAGNOSTICS" + echo "btest-diff: TEST_DIFF_CANONIFIER failed on file '$baseline'" >>"$TEST_DIAGNOSTICS" error=1 result=1 fi fi if [ $error -eq 0 ]; then - echo "== Diff ===============================" >>$TEST_DIAGNOSTICS + echo "== Diff ===============================" >>"$TEST_DIAGNOSTICS" if is_binary_mode; then - diff -s "$@" "$canon_baseline" "$canon_output" >>$TEST_DIAGNOSTICS + diff -s "$@" "$canon_baseline" "$canon_output" >>"$TEST_DIAGNOSTICS" else # We'd use --strip-trailing-cr in the following, but it's not guaranteed. diff -au "$@" \ <(sed 's/\r$//' "$canon_baseline") \ - <(sed 's/\r$//' "$canon_output") >>$TEST_DIAGNOSTICS + <(sed 's/\r$//' "$canon_output") >>"$TEST_DIAGNOSTICS" fi result=$? fi elif [ "$TEST_MODE" = "TEST" ]; then - echo "== Error ==============================" >>$TEST_DIAGNOSTICS - echo "test-diff: no baseline found." >>$TEST_DIAGNOSTICS + echo "== Error ==============================" >>"$TEST_DIAGNOSTICS" + echo "test-diff: no baseline found." >>"$TEST_DIAGNOSTICS" result=100 fi -echo "=======================================" >>$TEST_DIAGNOSTICS +echo "=======================================" >>"$TEST_DIAGNOSTICS" if [ "$TEST_MODE" = "TEST" ]; then exit $result @@ -278,5 +278,5 @@ elif [ "$TEST_MODE" = "UPDATE" ]; then exit 0 fi -echo "test-diff: unknown test mode $TEST_MODE" >$TEST_DIAGNOSTICS +echo "test-diff: unknown test mode $TEST_MODE" >"$TEST_DIAGNOSTICS" exit 1 diff --git a/testing/Scripts/convert-path-list.sh b/testing/Scripts/convert-path-list.sh index 15dce137..025a113c 100644 --- a/testing/Scripts/convert-path-list.sh +++ b/testing/Scripts/convert-path-list.sh @@ -13,4 +13,4 @@ for i in "${PARTS[@]}"; do new_list+=":" done -echo ${new_list%?} +echo "${new_list%?}"