check-python-formatting.sh 779 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env bash
  2. # Copyright Materialize, Inc. and contributors. All rights reserved.
  3. #
  4. # Use of this software is governed by the Business Source License
  5. # included in the LICENSE file at the root of this repository.
  6. #
  7. # As of the Change Date specified in that file, in accordance with
  8. # the Business Source License, use of this software will be governed
  9. # by the Apache License, Version 2.0.
  10. #
  11. # check-python-formatting.sh — check Python formatting.
  12. set -euo pipefail
  13. cd "$(dirname "$0")/../../../.."
  14. . misc/shlib/shlib.bash
  15. if [[ ! "${MZDEV_NO_PYTHON:-}" ]]; then
  16. try bin/pyfmt --check --diff
  17. if try_last_failed; then
  18. echo "lint: $(red error:) python formatting discrepancies found"
  19. echo "hint: run bin/pyfmt" >&2
  20. fi
  21. fi
  22. try_status_report