Skip to content

Commit

Permalink
Bump pre-commit hooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbannier committed Aug 7, 2023
1 parent 46f982c commit 3a6a0ac
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -15,26 +15,26 @@ 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
- id: end-of-file-fixer
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

Expand Down
42 changes: 21 additions & 21 deletions btest-diff
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
}

Expand All @@ -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 "<Content not shown>" >>$TEST_DIAGNOSTICS
echo "<Content not shown>" >>"$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

Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion testing/Scripts/convert-path-list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ for i in "${PARTS[@]}"; do
new_list+=":"
done

echo ${new_list%?}
echo "${new_list%?}"

0 comments on commit 3a6a0ac

Please sign in to comment.