File: ruff-format-all.sh

package info (click to toggle)
mongo-c-driver 2.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 49,532 kB
  • sloc: ansic: 197,016; python: 7,890; cpp: 2,343; sh: 693; makefile: 77
file content (30 lines) | stat: -rwxr-xr-x 915 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
#
# format.sh
#
# Usage:
#   uv run --frozen etc/ruff-format-all.sh
#
# This script is meant to be run from the project root directory.

set -o errexit
set -o pipefail

# Vendored scripts to keep in sync with upstream or external sources.
excludes=(
  --exclude build/bottle.py
  --exclude build/mongodl.py
)

# Scripts which require a different Python version than the one specified in pyproject.toml.
# See: https://github.com/astral-sh/ruff/issues/10457
py312=(
  src/libbson/tests/validate-tests.py
)

# Format imports: https://github.com/astral-sh/ruff/issues/8232
uv run --frozen --group format-scripts --isolated ruff check --select I --fix --target-version py312 "${py312[@]:?}"
uv run --frozen --group format-scripts ruff check --select I --fix --exclude "${py312[@]:?}" "${excludes[@]:?}"

# Format Python scripts.
uv run --frozen --group format-scripts ruff format "${excludes[@]:?}"