-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathlint
executable file
·96 lines (81 loc) · 2.68 KB
/
lint
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
set -e
# Unset VIRTUAL_ENV to avoid warnings about mismatched paths
unset VIRTUAL_ENV
# Overwrite .vscode/launch.json if it's different
cat > .vscode/launch.json << 'EOL'
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"type": "by-gdb",
"request": "launch",
"name": "Launch(gdb)",
"program": "tests/.build/bin/${fileBasenameNoExtension}",
"cwd": "${workspaceRoot}"
},
]
}
EOL
# # Function to handle ESLint output in the background
# run_eslint() {
# eslint_output_file="eslint_output.log"
# eslint src/platforms/wasm/compiler/*.js src/platforms/wasm/compiler/modules/*.js &> "$eslint_output_file" &
# eslint_pid=$!
# }
# # Start ESLint in the background if available
# if command -v eslint &> /dev/null; then
# echo "Running eslint in the background"
# run_eslint
# else
# echo "ESLint not found, skipping JavaScript linting"
# fi
# Linting the Python code.
echo "Running ruff check"
uvx ruff check --fix ci --exclude ci/tmp/ --exclude ci/wasm/
uvx ruff check --fix src/platforms/wasm/compiler/compile.py
uvx ruff check --fix src/platforms/wasm/compiler/server.py
UV run ruff check --fix dev/dev.py
echo Running black
uvx black ci --exclude ci/tmp/ --exclude ci/wasm/
uvx black src/platforms/wasm/compiler/compile.py
uvx black src/platforms/wasm/compiler/server.py
uvx black dev/dev.py
uvx echo Running isort
uvx isort --profile black ci --skip ci/tmp/ --skip ci/wasm/
uvx isort --profile black src/platforms/wasm/compiler/compile.py
uvx isort --profile black src/platforms/wasm/compiler/server.py
uvx isort --profile black dev/dev.py
echo "Running mypy"
uvx echo yes | mypy --install-type
uvx mypy ci --exclude ci/tmp/ --exclude ci/wasm/
uvx mypy src/platforms/wasm/compiler/compile.py
uvx mypy src/platforms/wasm/compiler/server.py
uvx mypy dev/dev.py
# Linting the C++ code.
folders=(
#"src/lib8tion"
#"src/platforms/stub"
#"src/platforms/apollo3" # clang-format breaks apollo3
#"src/platforms/esp/8266" # clang-format breaks esp8266
#"src/platforms/arm" # clang-format breaks arm
)
for folder in "${folders[@]}"; do
echo "Running clang-format on $folder"
uvx ci/run-clang-format.py -i -r "$folder"
done
# # Wait for ESLint to finish and output its results
# if [ -n "$eslint_pid" ]; then
# echo "Waiting for ESLint to complete..."
# wait "$eslint_pid"
# echo "ESLint output:"
# cat "$eslint_output_file"
# rm "$eslint_output_file"
# fi