-
Notifications
You must be signed in to change notification settings - Fork 0
/
checks.sh
executable file
·46 lines (35 loc) · 1.22 KB
/
checks.sh
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
#!/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
# work from the root of the repo
cd "$(dirname "$0")"
headerStart="\n\033[4;34m=== "
headerEnd=" ===\033[0m\n"
echo "${headerStart}Checking Python: Ruff, format, check${headerEnd}"
# I is import sorting
ruff check --select I
ruff format --check
echo "${headerStart}Checking for Misspellings${headerEnd}"
find . -type f | grep -v "/node_modules/" | grep -v "/\." | grep -v "/dist/" | grep -v "/desktop/build/" | xargs misspell -error
echo "No misspellings found"
echo "${headerStart}Web UI: format, lint, check${headerEnd}"
changed_files=$(git diff --name-only --staged)
if [[ "$changed_files" == *"app/web_ui/"* ]]; then
echo "${headerStart}Checking Web UI: format, lint, check${headerEnd}"
cd app/web_ui
npm run format_check
npm run lint
npm run check
npm run test_run
echo "Running vite build"
npm run build > /dev/null
cd ../..
else
echo "Skipping Web UI: no files changed"
fi
echo "${headerStart}Running Python Tests${headerEnd}"
python3 -m pytest -q .
echo "${headerStart}Checking Types${headerEnd}"
pyright .