diff --git a/.vscode/tasks.json b/.vscode/tasks.json index e1468bdfc2ad..5c21a478a8df 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,9 +12,7 @@ "type": "npm", "script": "compile", "isBackground": true, - "problemMatcher": [ - "$tsc-watch" - ], + "problemMatcher": ["$tsc-watch"], "group": { "kind": "build", "isDefault": true @@ -34,6 +32,29 @@ "script": "preTestJediLSP", "problemMatcher": [], "label": "preTestJediLSP" + }, + { + "label": "Run check_pr.sh", + "type": "shell", + "command": "${workspaceFolder}/check_pr.sh", + "options": { + "cwd": "${workspaceFolder}", + "env": { + "VIRTUAL_ENV": "${workspaceFolder}/.venv", + "PATH": "${workspaceFolder}/.venv/bin/python" + } + }, + "group": { + "kind": "build", + "isDefault": false + }, + "problemMatcher": [], + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared" + } } ] } diff --git a/check_pr.sh b/check_pr.sh new file mode 100755 index 000000000000..3329c756cc6c --- /dev/null +++ b/check_pr.sh @@ -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!"