Make shfmt happier

This commit is contained in:
Michael Wolf
2023-09-30 17:30:15 -06:00
parent 9936c641a2
commit 5d3dc8003e

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
set -uo pipefail set -uo pipefail
IFS=$'\n\t' IFS=$'\n\t'
@@ -9,17 +9,17 @@ source "$DIR/_reformat-common.bash"
file="$1" file="$1"
if [[ "$WOULD_REFORMAT" = "would_reformat" ]] ; then if [[ "$WOULD_REFORMAT" = "would_reformat" ]]; then
out1=$(pipx run isort "$file" 2>/dev/null) out1=$(pipx run isort "$file" 2>/dev/null)
c1="$?" c1="$?"
if [[ "$c1" != "0" ]] ; then if [[ "$c1" != "0" ]]; then
# would reorder imports # would reorder imports
if [[ "$c1" = "1" ]] ; then if [[ "$c1" = "1" ]]; then
exit 1 exit 1
fi fi
# syntax error; 123 is normalized to 2 # syntax error; 123 is normalized to 2
if [[ "$c1" = "123" ]] ; then if [[ "$c1" = "123" ]]; then
exit 2 exit 2
fi fi
# some other problem that we don't know how to handle # some other problem that we don't know how to handle
@@ -34,7 +34,7 @@ if [[ "$WOULD_REFORMAT" = "would_reformat" ]] ; then
exit "$c2" exit "$c2"
fi fi
if [[ "$WOULD_REFORMAT" = "do_reformat" ]] ; then if [[ "$WOULD_REFORMAT" = "do_reformat" ]]; then
out1=$(pipx run black "$1" 2>/dev/null && pipx run isort "$file" 2>/dev/null) out1=$(pipx run black "$1" 2>/dev/null && pipx run isort "$file" 2>/dev/null)
c="$?" c="$?"
@@ -44,4 +44,3 @@ if [[ "$WOULD_REFORMAT" = "do_reformat" ]] ; then
fi fi
exit 255 exit 255