Skip to content

Commit

Permalink
Remove outdated workaround for a bug in black formatter
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 committed Mar 21, 2023
1 parent f636c5f commit ca2f9cd
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions check/format-incremental
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 ca2f9cd

Please sign in to comment.