Make shellcheck happier
This commit is contained in:
@@ -9,33 +9,37 @@ source "$DIR/_reformat-common.bash"
|
|||||||
|
|
||||||
file="$1"
|
file="$1"
|
||||||
|
|
||||||
if [[ x"$WOULD_REFORMAT" = x"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 [[ x"$c1" != x"0" ]] ; then
|
if [[ "$c1" != "0" ]] ; then
|
||||||
# would reorder imports
|
# would reorder imports
|
||||||
if [[ x"$c1" = x"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 [[ x"$c1" = x"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
|
||||||
exit 255
|
exit 255
|
||||||
fi
|
fi
|
||||||
|
|
||||||
out2=$(pipx run black --check $file 2>/dev/null)
|
out2=$(pipx run black --check "$file" 2>/dev/null)
|
||||||
c2="$?"
|
c2="$?"
|
||||||
|
|
||||||
|
printf '%s\n%s' "$out1" "$out2"
|
||||||
|
|
||||||
exit "$c2"
|
exit "$c2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ x"$WOULD_REFORMAT" = x"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="$?"
|
||||||
|
|
||||||
|
printf '%s\n' "$out1"
|
||||||
|
|
||||||
exit "$c"
|
exit "$c"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user