-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlint
More file actions
executable file
·49 lines (42 loc) · 1.64 KB
/
Copy pathlint
File metadata and controls
executable file
·49 lines (42 loc) · 1.64 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
set -e
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
if [[ $# -gt 1 || ($# -eq 1 && "$1" != "--skip-dylint") ]]; then
echo "Usage: ./lint [--skip-dylint]" >&2
exit 2
fi
SKIP_DYLINT=${1:-}
LINT_PATHS=(src tests ci)
# Python stages run first: they need no Rust toolchain, so a host without
# soldr/rustup/cargo-dylint still gets full Python coverage (#262).
echo "Running ruff ${LINT_PATHS[*]}"
uv run ruff check --fix "${LINT_PATHS[@]}"
echo "Running black ${LINT_PATHS[*]}"
uv run black "${LINT_PATHS[@]}"
echo "Running isort ${LINT_PATHS[*]}"
uv run isort --profile black "${LINT_PATHS[@]}"
echo "Running pyright ${LINT_PATHS[*]}"
uv run pyright "${LINT_PATHS[@]}"
echo "Running keyboard interrupt checker ${LINT_PATHS[*]}"
uv run python ci/lint_python/keyboard_interrupt_checker.py "${LINT_PATHS[@]}"
# Rust linting goes through soldr so the zccache compile cache is hit.
# Install soldr with: uv tool install soldr (or see zackees/soldr).
if ! command -v soldr &> /dev/null; then
echo "Error: soldr is required for Rust linting. Install with: uv tool install soldr" >&2
exit 1
fi
echo Running cargo fmt check
soldr cargo fmt --all --check
echo Running cargo clippy
soldr cargo clippy --workspace --all-targets -- -D warnings
if [[ "$SKIP_DYLINT" != "--skip-dylint" ]]; then
echo Running ban_std_pathbuf dylint
export SOLDR_FORCE_MANAGED_CARGO_SUBCOMMANDS=1
if ! env -u RUSTUP_TOOLCHAIN soldr dylint prepare; then
echo "Error: dylint prerequisites are missing: soldr dylint prepare failed" >&2
exit 1
fi
env -u RUSTUP_TOOLCHAIN soldr dylint --all -- --workspace --all-targets
fi
echo Linting complete!
exit 0