Skip to content

Commit

Permalink
add script and task to run PR checks locally
Browse files Browse the repository at this point in the history
  • Loading branch information
eleanorjboyd committed Nov 1, 2024
1 parent 379229a commit bbbcd22
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
20 changes: 17 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
"type": "npm",
"script": "compile",
"isBackground": true,
"problemMatcher": [
"$tsc-watch"
],
"problemMatcher": ["$tsc-watch"],
"group": {
"kind": "build",
"isDefault": true
Expand All @@ -34,6 +32,22 @@
"script": "preTestJediLSP",
"problemMatcher": [],
"label": "preTestJediLSP"
},
{
"label": "Run checkPR.sh",
"type": "shell",
"command": "${workspaceFolder}/scripts/checkPR.sh",
"group": {
"kind": "build",
"isDefault": false
},
"problemMatcher": [],
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
}
}
]
}
40 changes: 40 additions & 0 deletions scripts/checkPR.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

# Function to run a command and check its status
run_command() {
echo "Running: '$1'"
echo "----------------------------------------"
$1
if [ $? -ne 0 ]; then
echo "FAILURE: '$1'"
exit 1
else
echo "----------------------------------------"
echo "SUCCESS: '$1'"
echo "----------------------------------------"
fi
}

# Check dependencies
run_command "npm run checkDependencies"

# Run linter
run_command "npm run lint"

# Check formatting
run_command "npm run format-check"

# Activate the virtual environment
source ".venv/bin/activate"

# Change directory to python_files
cd python_files || exit

# Run Pyright
run_command "python -m pyright"

# Run Ruff
run_command "python -m ruff ."
echo "----------------------------------------"
echo "----------------------------------------"
echo "All checks passed successfully!"

0 comments on commit bbbcd22

Please sign in to comment.