Skip to content

Commit bbbcd22

Browse files
committed
add script and task to run PR checks locally
1 parent 379229a commit bbbcd22

File tree

2 files changed

+57
-3
lines changed

2 files changed

+57
-3
lines changed

.vscode/tasks.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
"type": "npm",
1313
"script": "compile",
1414
"isBackground": true,
15-
"problemMatcher": [
16-
"$tsc-watch"
17-
],
15+
"problemMatcher": ["$tsc-watch"],
1816
"group": {
1917
"kind": "build",
2018
"isDefault": true
@@ -34,6 +32,22 @@
3432
"script": "preTestJediLSP",
3533
"problemMatcher": [],
3634
"label": "preTestJediLSP"
35+
},
36+
{
37+
"label": "Run checkPR.sh",
38+
"type": "shell",
39+
"command": "${workspaceFolder}/scripts/checkPR.sh",
40+
"group": {
41+
"kind": "build",
42+
"isDefault": false
43+
},
44+
"problemMatcher": [],
45+
"presentation": {
46+
"echo": true,
47+
"reveal": "always",
48+
"focus": false,
49+
"panel": "shared"
50+
}
3751
}
3852
]
3953
}

scripts/checkPR.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
# Function to run a command and check its status
4+
run_command() {
5+
echo "Running: '$1'"
6+
echo "----------------------------------------"
7+
$1
8+
if [ $? -ne 0 ]; then
9+
echo "FAILURE: '$1'"
10+
exit 1
11+
else
12+
echo "----------------------------------------"
13+
echo "SUCCESS: '$1'"
14+
echo "----------------------------------------"
15+
fi
16+
}
17+
18+
# Check dependencies
19+
run_command "npm run checkDependencies"
20+
21+
# Run linter
22+
run_command "npm run lint"
23+
24+
# Check formatting
25+
run_command "npm run format-check"
26+
27+
# Activate the virtual environment
28+
source ".venv/bin/activate"
29+
30+
# Change directory to python_files
31+
cd python_files || exit
32+
33+
# Run Pyright
34+
run_command "python -m pyright"
35+
36+
# Run Ruff
37+
run_command "python -m ruff ."
38+
echo "----------------------------------------"
39+
echo "----------------------------------------"
40+
echo "All checks passed successfully!"

0 commit comments

Comments
 (0)