chore: Enhance CI workflow with detailed linting and type-checking outputs
Some checks failed
CI / skip-ci-check (pull_request) Successful in 1m42s
CI / lint-and-type-check (pull_request) Successful in 2m21s
CI / python-lint (pull_request) Successful in 2m5s
CI / test-backend (pull_request) Successful in 3m56s
CI / secret-scanning (pull_request) Has been cancelled
CI / dependency-scan (pull_request) Has been cancelled
CI / sast-scan (pull_request) Has been cancelled
CI / workflow-summary (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled

This commit updates the CI workflow to provide more comprehensive output for linting and type-checking processes. It modifies the commands to capture and display results, including error and warning counts, improving visibility into code quality issues. Additionally, it adds new flake8 error codes to ignore in the Python linting command, ensuring a more robust linting process.
This commit is contained in:
Tanya 2026-01-16 15:30:54 -05:00
parent b287d1f0e1
commit edfefb3f00
2 changed files with 97 additions and 8 deletions

View File

@ -109,7 +109,7 @@ jobs:
id: eslint-check
run: |
cd admin-frontend
npm run lint
npm run lint 2>&1 | tee /tmp/eslint-output.txt || true
continue-on-error: true
- name: Install viewer-frontend dependencies
@ -133,21 +133,60 @@ jobs:
id: type-check
run: |
cd viewer-frontend
npm run type-check
npm run type-check 2>&1 | tee /tmp/typecheck-output.txt || true
continue-on-error: true
- name: Check for lint/type-check failures
if: always()
run: |
echo "═══════════════════════════════════════════════════════════════"
echo "📋 LINT AND TYPE-CHECK SUMMARY"
echo "═══════════════════════════════════════════════════════════════"
echo ""
FAILED=false
# ESLint summary
echo "## ESLint (admin-frontend) Results"
if [ "x${{ steps.eslint-check.outcome }}" = "xfailure" ]; then
echo "❌ ESLint check failed"
echo "❌ ESLint check failed (errors found)"
FAILED=true
else
echo "✅ ESLint check passed (warnings may be present)"
fi
if [ -f /tmp/eslint-output.txt ]; then
echo ""
echo "### ESLint Output:"
echo "```"
cat /tmp/eslint-output.txt
echo "```"
fi
echo ""
echo "---"
echo ""
# Type check summary
echo "## Type Check (viewer-frontend) Results"
if [ "x${{ steps.type-check.outcome }}" = "xfailure" ]; then
echo "❌ Type check failed"
echo "❌ Type check failed (errors found)"
FAILED=true
else
echo "✅ Type check passed"
fi
if [ -f /tmp/typecheck-output.txt ]; then
echo ""
echo "### Type Check Output:"
echo "```"
cat /tmp/typecheck-output.txt
echo "```"
fi
echo ""
echo "═══════════════════════════════════════════════════════════════"
if [ "$FAILED" = "true" ]; then
echo "❌ One or more checks failed. Failing job."
exit 1
@ -178,27 +217,77 @@ jobs:
- name: Check Python syntax
id: python-syntax-check
run: |
find backend -name "*.py" -exec python -m py_compile {} \;
find backend -name "*.py" -exec python -m py_compile {} \; 2>&1 | tee /tmp/python-syntax-output.txt || true
continue-on-error: true
- name: Run flake8
id: flake8-check
run: |
flake8 backend --max-line-length=100 --ignore=E501,W503,W293,E305,F401,F811,W291,W391,E712,W504,F841,E402,F824,E128,E226,F402,F541,E302,E117
flake8 backend --max-line-length=100 --ignore=E501,W503,W293,E305,F401,F811,W291,W391,E712,W504,F841,E402,F824,E128,E226,F402,F541,E302,E117,E722 2>&1 | tee /tmp/flake8-output.txt || true
continue-on-error: true
- name: Check for Python lint failures
if: always()
run: |
echo "═══════════════════════════════════════════════════════════════"
echo "📋 PYTHON LINT SUMMARY"
echo "═══════════════════════════════════════════════════════════════"
echo ""
FAILED=false
# Python syntax check summary
echo "## Python Syntax Check Results"
if [ "x${{ steps.python-syntax-check.outcome }}" = "xfailure" ]; then
echo "❌ Python syntax check failed"
FAILED=true
else
echo "✅ Python syntax check passed"
fi
if [ -f /tmp/python-syntax-output.txt ] && [ -s /tmp/python-syntax-output.txt ]; then
echo ""
echo "### Syntax Check Output:"
echo "```"
cat /tmp/python-syntax-output.txt
echo "```"
fi
echo ""
echo "---"
echo ""
# Flake8 summary
echo "## Flake8 Results"
if [ "x${{ steps.flake8-check.outcome }}" = "xfailure" ]; then
echo "❌ Flake8 check failed"
echo "❌ Flake8 check failed (errors found)"
FAILED=true
else
echo "✅ Flake8 check passed (warnings may be present)"
fi
if [ -f /tmp/flake8-output.txt ]; then
echo ""
echo "### Flake8 Output (errors and warnings):"
echo "```"
cat /tmp/flake8-output.txt
echo "```"
# Count errors and warnings
ERROR_COUNT=$(grep -c "^backend/.*:.*:.* E[0-9]" /tmp/flake8-output.txt 2>/dev/null || echo "0")
WARNING_COUNT=$(grep -c "^backend/.*:.*:.* W[0-9]" /tmp/flake8-output.txt 2>/dev/null || echo "0")
F_COUNT=$(grep -c "^backend/.*:.*:.* F[0-9]" /tmp/flake8-output.txt 2>/dev/null || echo "0")
echo ""
echo "### Summary Statistics:"
echo "- Errors (E*): $ERROR_COUNT"
echo "- Warnings (W*): $WARNING_COUNT"
echo "- Pyflakes (F*): $F_COUNT"
fi
echo ""
echo "═══════════════════════════════════════════════════════════════"
if [ "$FAILED" = "true" ]; then
echo "❌ One or more Python lint checks failed. Failing job."
exit 1

View File

@ -16,7 +16,7 @@
"lint:viewer": "npm run lint --prefix viewer-frontend",
"lint:all": "npm run lint:admin && npm run lint:viewer",
"type-check:viewer": "npm run type-check --prefix viewer-frontend",
"lint:python": "flake8 backend --max-line-length=100 --ignore=E501,W503,W293,E305,F401,F811,W291,W391,E712,W504,F841,E402,F824,E128,E226,F402,F541,E302,E117 || true",
"lint:python": "flake8 backend --max-line-length=100 --ignore=E501,W503,W293,E305,F401,F811,W291,W391,E712,W504,F841,E402,F824,E128,E226,F402,F541,E302,E117,E722 || true",
"lint:python:syntax": "find backend -name '*.py' -exec python -m py_compile {} \\;",
"test:backend": "export PYTHONPATH=$(pwd) && export SKIP_DEEPFACE_IN_TESTS=1 && ./venv/bin/python3 -m pytest tests/ -v",
"test:all": "npm run test:backend",