12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #!/usr/bin/env bash
- # Copyright Materialize, Inc. and contributors. All rights reserved.
- #
- # Use of this software is governed by the Business Source License
- # included in the LICENSE file at the root of this repository.
- #
- # As of the Change Date specified in that file, in accordance with
- # the Business Source License, use of this software will be governed
- # by the Apache License, Version 2.0.
- #
- # pyfmt — formats Python code with Black.
- set -euo pipefail
- cd "$(dirname "$0")/.."
- . misc/shlib/shlib.bash
- try bin/pyactivate -m black . "$@"
- arg="--fix"
- while [[ $# -gt 0 ]]; do
- case $1 in
- --check)
- # ruff only supports --fix, not --check
- arg=""
- shift
- ;;
- *)
- # Ignore all unknown arguments
- shift
- ;;
- esac
- done
- # We want empty arg to not do anything
- # shellcheck disable=SC2086
- try bin/pyactivate -m ruff $arg --extend-exclude=misc/dbt-materialize .
- # shellcheck disable=SC2086
- try bin/pyactivate -m ruff --target-version=py38 $arg misc/dbt-materialize
- try_status_report
|