-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_checks.sh
56 lines (47 loc) · 1.48 KB
/
run_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
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Print header
echo "========================================"
echo "Running Ruff checks and fixes"
echo "========================================"
# Run Ruff checks
echo "Running initial Ruff checks..."
if python -m ruff check .; then
echo "✓ No Ruff issues found."
else
echo "Ruff found issues. Attempting to fix..."
if python -m ruff check --fix .; then
echo "✓ Ruff fixes applied successfully."
else
echo "⚠ Some issues could not be automatically fixed. Please fix them manually."
fi
fi
echo ""
echo "========================================"
echo "Running pytest with coverage"
echo "========================================"
# Run pytest with coverage
echo "Running tests with coverage report..."
python -m pytest --cov=. --cov-report=term-missing
# Check if tests passed
TEST_EXIT_CODE=$?
if [ $TEST_EXIT_CODE -eq 0 ]; then
echo "✓ All tests passed successfully."
else
echo "⚠ Some tests failed. Please review the test output."
fi
# Print completion message
echo ""
echo "========================================"
echo "Check and test process completed"
echo "========================================"
# Check if any files were modified during the process
if git diff --quiet; then
echo "No files were modified during checks."
else
echo "The following files were modified:"
git diff --name-only
fi
# Exit with the pytest exit code
exit $TEST_EXIT_CODE