Skip to content

Commit

Permalink
Remove outdated workaround for a bug in black formatter (#6045)
Browse files Browse the repository at this point in the history
The bug appears to be fixed in our required version of black per
psf/black#1629
  • Loading branch information
pavoljuhas authored Mar 21, 2023
1 parent cc8fc31 commit 4607dd1
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions check/format-incremental
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,8 @@ if (( only_print == 1 )); then
args+=("--check" "--diff")
fi

# Warn users about bug in black: https://github.com/psf/black/issues/1629
# Once that is fixed upstream, we can just do:
# black "${args[@]}" "${format_files[@]}"
# exit $?
LOGS="$(black "${args[@]}" "${format_files[@]}" 2>&1)"
black "${args[@]}" "${format_files[@]}"
BLACKSTATUS=$?
echo "${LOGS}"
if [[ "$BLACKSTATUS" == "123" && "$LOGS" =~ ^.*"INTERNAL ERROR: Black produced different code on the second pass of the formatter.".*$ ]]; then
echo -e "\033[31mWarning, it seems we ran into https://github.com/psf/black/issues/1629. Typically, this can be fixed by adding a trailing comma. If you get stuck, please file a cirq issue on github.\033[0m"
fi

if [[ "$FLYNTSTATUS" != "0" || "$BLACKSTATUS" != "0" ]]; then
exit 1
Expand Down

0 comments on commit 4607dd1

Please sign in to comment.