File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828 echo " Checking file format in" " $@ "
2929fi
3030
31- if [ ! -f " scripts/env/bin/activate " ]
32- then
33- python3 -m venv scripts/env
31+ if [ ! -x " $( command -v uv ) " ]; then
32+ echo " uv is required but not installed. See https://docs.astral.sh/uv/getting-started/installation/ " >&2
33+ exit 1
3434fi
3535
36- source scripts/env/bin/activate
37- pip install -U pip
38- pip install ' gersemi==0.17.0' 1> /dev/null
36+ GERSEMI=" uvx gersemi@0.17.0"
3937
4038FILES=$( git ls-files " $@ " | grep -e ' \.cmake$' -e ' CMakeLists\.txt$' )
4139
4240if $fix ; then
4341 # shellcheck disable=SC2086
44- gersemi -i $FILES
42+ $GERSEMI -i $FILES
4543 echo " All files formatted!"
4644else
4745 # shellcheck disable=SC2086
48- if gersemi --check $FILES ; then
46+ if $GERSEMI --check $FILES ; then
4947 echo " All files formatted correctly!"
5048 else
5149 echo " Fix formatting by running: scripts/cmake-format-checks.sh -f"
Original file line number Diff line number Diff line change @@ -43,17 +43,16 @@ mapfile -t files < <(git ls-files "$@" | grep -e '\.h$' -e '\.hpp$' -e '\.cpp$'
4343# --- Format check (parallel) ---
4444if [ " ${# files[@]} " -eq 0 ]; then
4545 unformatted_files=" "
46- elif $fix ; then
47- # In fix mode, format first then check what changed
48- printf ' %s\n' " ${files[@]} " | xargs -P " $NPROC " -n 50 " $CLANG_FORMAT " -style=file -i
49-
50- # Re-check to report which files were fixed
51- unformatted_files=$( git diff --name-only -- " ${files[@]} " ) || true
5246else
53- # Check mode: collect filenames from clang-format warnings (parallel)
47+ # Check which files need formatting (parallel)
5448 unformatted_files=$( printf ' %s\n' " ${files[@]} " | \
5549 xargs -P " $NPROC " -n 50 " $CLANG_FORMAT " -n -Werror -style=file 2>&1 | \
5650 sed -n ' s/^\(.*\):[0-9]*:[0-9]*:.*/\1/p' | sort -u) || true
51+
52+ if $fix && [ " $unformatted_files " != " " ]; then
53+ # Fix only the files that failed the check
54+ echo " $unformatted_files " | xargs -P " $NPROC " -n 50 " $CLANG_FORMAT " -style=file -i
55+ fi
5756fi
5857
5958# --- File name check ---
Original file line number Diff line number Diff line change @@ -11,9 +11,12 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
1111ROOT_DIR=$( dirname " $SCRIPT_DIR " )
1212cd " $ROOT_DIR " || exit 1
1313
14- NPM_DIR=$( mktemp -d) || exit 1
15- trap ' rm -rf "$NPM_DIR"' EXIT
16- npm install --loglevel=error --no-save --prefix " $NPM_DIR " @apidevtools/swagger-cli 1> /dev/null || exit 1
14+ if [ ! -x " $( command -v uv) " ]; then
15+ echo " uv is required but not installed. See https://docs.astral.sh/uv/getting-started/installation/" >&2
16+ exit 1
17+ fi
1718
18- find doc/schemas/* .json -exec npx --prefix " $NPM_DIR " swagger-cli validate {} \; || exit 1
19- find doc/schemas/gov/* /* .json -exec npx --prefix " $NPM_DIR " swagger-cli validate {} \;
19+ VALIDATOR=" uvx --from openapi-spec-validator openapi-spec-validator"
20+
21+ $VALIDATOR doc/schemas/* .json || exit 1
22+ $VALIDATOR doc/schemas/gov/* /* .json
Original file line number Diff line number Diff line change @@ -17,17 +17,13 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
1717ROOT_DIR=$( dirname " $SCRIPT_DIR " )
1818cd " $ROOT_DIR " || exit 1
1919
20- # Ensure venv exists and activate (uses a dedicated venv to allow concurrent runs)
21- if [ ! -f " scripts/env-format/bin/activate " ] ; then
22- python3 -m venv scripts/env-format
20+ if [ ! -x " $( command -v uv ) " ] ; then
21+ echo " uv is required but not installed. See https://docs.astral.sh/uv/getting-started/installation/ " >&2
22+ exit 1
2323fi
24- source scripts/env-format/bin/activate
25-
26- pip install -U pip > /dev/null || exit 1
27- pip install -U wheel black 1> /dev/null || exit 1
2824
2925if [ $FIX -ne 0 ]; then
30- git ls-files tests/ python/ scripts/ tla/ | grep -e ' \.py$' | xargs black
26+ git ls-files tests/ python/ scripts/ tla/ | grep -e ' \.py$' | xargs uvx black
3127else
32- git ls-files tests/ python/ scripts/ tla/ | grep -e ' \.py$' | xargs black --check
28+ git ls-files tests/ python/ scripts/ tla/ | grep -e ' \.py$' | xargs uvx black --check
3329fi
Original file line number Diff line number Diff line change @@ -17,19 +17,13 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
1717ROOT_DIR=$( dirname " $SCRIPT_DIR " )
1818cd " $ROOT_DIR " || exit 1
1919
20- # Ensure venv exists and activate (uses a dedicated venv to allow concurrent runs)
21- if [ ! -f " scripts/env-lint/bin/activate " ] ; then
22- python3 -m venv scripts/env-lint || exit 1
20+ if [ ! -x " $( command -v uv ) " ] ; then
21+ echo " uv is required but not installed. See https://docs.astral.sh/uv/getting-started/installation/ " >&2
22+ exit 1
2323fi
24- source scripts/env-lint/bin/activate || exit 1
25-
26- pip install -U pip > /dev/null || exit 1
27- pip install -U wheel ruff 1> /dev/null || exit 1
28- pip install -U -r tests/requirements.txt 1> /dev/null || exit 1
29- pip install -U ./python 1> /dev/null || exit 1
3024
3125if [ $FIX -ne 0 ]; then
32- ruff check --fix python/ tests/
26+ uvx ruff check --fix python/ tests/
3327else
34- ruff check python/ tests/
28+ uvx ruff check python/ tests/
3529fi
Original file line number Diff line number Diff line change @@ -11,14 +11,9 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
1111ROOT_DIR=$( dirname " $SCRIPT_DIR " )
1212cd " $ROOT_DIR " || exit 1
1313
14- # Ensure venv exists and activate (uses a dedicated venv to allow concurrent runs)
15- if [ ! -f " scripts/env-types/bin/activate " ] ; then
16- python3 -m venv scripts/env-types || exit 1
14+ if [ ! -x " $( command -v uv ) " ] ; then
15+ echo " uv is required but not installed. See https://docs.astral.sh/uv/getting-started/installation/ " >&2
16+ exit 1
1717fi
18- source scripts/env-types/bin/activate || exit 1
1918
20- pip install -U pip > /dev/null || exit 1
21- pip install -U wheel pytest-mypy mypy 1> /dev/null || exit 1
22- pip install ./python 1> /dev/null || exit 1
23-
24- git ls-files python/ | grep -e ' \.py$' | xargs mypy
19+ git ls-files python/ | grep -e ' \.py$' | xargs uvx --with ./python --with pytest mypy
You can’t perform that action at this time.
0 commit comments