-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathchecks.sh
More file actions
executable file
·53 lines (42 loc) · 1.65 KB
/
checks.sh
File metadata and controls
executable file
·53 lines (42 loc) · 1.65 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
50
51
52
53
#!/bin/sh
# Check our project: formatting, linting, testing, building, etc.
# Good to call this from .git/hooks/pre-commit
# Important: run with `uv run` to setup the environment
set -e
# Parse command line arguments
# --staged-only is useful to only run checks on the types of files that are staged for commit, speeding up pre-commit hooks
staged_only=false
for arg in "$@"; do
case $arg in
--staged-only)
staged_only=true
shift
;;
*)
echo "Unknown option: $arg"
echo "Usage: $0 [--staged-only]"
exit 1
;;
esac
done
# work from the root of the repo
cd "$(dirname "$0")"
headerStart="\n\033[4;34m=== "
headerEnd=" ===\033[0m\n"
echo "${headerStart}Checking Python: uvx ruff check ${headerEnd}"
uvx ruff check
echo "${headerStart}Checking Python: uvx ruff format --check ${headerEnd}"
uvx ruff format --check .
echo "${headerStart}Checking Python Types: uvx ty check${headerEnd}"
uvx ty check
echo "${headerStart}Checking for Misspellings${headerEnd}"
if command -v misspell >/dev/null 2>&1; then
find . -type f | grep -v "/node_modules/" | grep -v "/\." | grep -v "/dist/" | grep -v "/desktop/build/" | grep -v "/app/web_ui/build/" | xargs misspell -error
echo "No misspellings found"
else
echo "\033[31mWarning: misspell command not found. Skipping misspelling check.\033[0m"
echo "\033[31mTo install follow the instructions at https://github.com/golangci/misspell \033[0m"
fi
# Check if python files were changed, and run tests if so
echo "${headerStart}Running Python Tests${headerEnd}"
uv run python -m pytest -q -m 'not docker_integration' -n auto .