Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "main/backend/uv.lock"
cache-dependency-glob: "backend/uv.lock"

- name: Setup Bun
uses: oven-sh/setup-bun@v1
Expand All @@ -29,59 +29,53 @@ jobs:
uses: extractions/setup-just@v2

- name: Install backend dependencies
working-directory: main
run: cd backend && uv sync --dev

- name: Install frontend dependencies
working-directory: main
run: cd frontend && bun install --frozen-lockfile

- name: Install code quality tools
run: npm install -g jscpd fallow

- name: Run fallow analysis (frontend — SvelteKit)
working-directory: main
run: cd frontend && npx fallow --format json --sarif-file fallow-results.sarif > fallow-results.json
continue-on-error: true

- name: Upload fallow SARIF results (frontend)
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: main/frontend/fallow-results.sarif
sarif_file: frontend/fallow-results.sarif
category: fallow-frontend

- name: Run duplication analysis (backend only)
working-directory: main
run: just duplication

- name: Run complexity analysis
working-directory: main
run: just complexity

- name: Run dead code analysis (backend — Python)
working-directory: main
run: cd backend && uv run vulture app/ vulture_whitelist.py --min-confidence 80 2>&1 | tee ../vulture-report.txt
continue-on-error: true

- name: Run dead code analysis (frontend — SvelteKit)
working-directory: main
run: cd frontend && npx fallow dead-code --format json > ../fallow-frontend-dead-code.json
continue-on-error: true

- name: Check quality thresholds
working-directory: main
run: |
echo "=== Quality Threshold Check ==="
FAIL=0
if [ -f jscpd-report/index.html ]; then
DUP_PCT=$(grep -oP '\d+(?=%)' jscpd-report/index.html | head -1)
if [ -f jscpd-report/jscpd-report.html ]; then
# Scope to the "Duplicated Lines" stat card; a bare grep for digits
# before % matches CSS values like width:100% earlier in the HTML.
DUP_PCT=$(grep -A1 'Duplicated Lines' jscpd-report/jscpd-report.html | grep -oP '\d+(?:\.\d+)?(?=%)' | head -1)
if [ -z "$DUP_PCT" ]; then
echo "::warning::Could not parse duplication percentage from jscpd report"
DUP_PCT=0
fi
echo "Duplication: ${DUP_PCT}%"
if [ "$DUP_PCT" -gt 20 ] 2>/dev/null; then
if awk "BEGIN {exit !($DUP_PCT > 20)}"; then
echo "::error::Duplication above 20% threshold: ${DUP_PCT}%"
FAIL=1
fi
Expand Down Expand Up @@ -125,11 +119,11 @@ jobs:
with:
name: code-quality-reports
path: |
main/jscpd-report/
main/vulture-report.txt
main/frontend/fallow-results.json
main/frontend/fallow-results.sarif
main/fallow-frontend-dead-code.json
jscpd-report/
vulture-report.txt
frontend/fallow-results.json
frontend/fallow-results.sarif
fallow-frontend-dead-code.json

- name: Create failure issue
if: failure()
Expand Down
Loading