Skip to content
Closed
Show file tree
Hide file tree
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
146 changes: 146 additions & 0 deletions .github/workflows/01-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: Lint & Static Analysis

Check warning on line 1 in .github/workflows/01-lint.yml

View workflow job for this annotation

GitHub Actions / YAML Lint

1:1 [document-start] missing document start "---"

on:

Check warning on line 3 in .github/workflows/01-lint.yml

View workflow job for this annotation

GitHub Actions / YAML Lint

3:1 [truthy] truthy value should be one of [false, true]
pull_request:
branches: [main]
push:
branches: [main]

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false # Show all linter failures, not just the first
matrix:
include:
# Configuration file linting
- id: yamllint
name: "YAML Lint"
cmd: |
pip install yamllint
yamllint .github/

- id: jsonlint
name: "JSON Lint"
cmd: |
find . -name '*.json' -not -path './node_modules/*' -not -path './.git/*' -exec jq empty {} \; || exit 1

Check failure on line 29 in .github/workflows/01-lint.yml

View workflow job for this annotation

GitHub Actions / YAML Lint

29:81 [line-length] line too long (118 > 80 characters)

- id: toml-check
name: "TOML Lint"
cmd: |
pip install toml
python -c "import toml; toml.load(open('backend/pyproject.toml'))"

# Python backend linting
- id: ruff-check
name: "Ruff Check"
working-directory: backend
cmd: |
pip install poetry
poetry install --only dev
poetry run ruff check rag_solution/ --line-length 120

- id: ruff-format
name: "Ruff Format Check"
working-directory: backend
cmd: |
pip install poetry
poetry install --only dev
poetry run ruff format --check rag_solution/

- id: mypy
name: "MyPy Type Check"
working-directory: backend
cmd: |
pip install poetry
poetry install --only dev
poetry run mypy rag_solution/ --ignore-missing-imports

- id: pylint
name: "Pylint Quality"
working-directory: backend
cmd: |
pip install poetry
poetry install --only dev
poetry run pylint rag_solution/ --exit-zero # Non-blocking for now

Check failure on line 68 in .github/workflows/01-lint.yml

View workflow job for this annotation

GitHub Actions / YAML Lint

68:81 [line-length] line too long (81 > 80 characters)

- id: pydocstyle
name: "Docstring Style"
working-directory: backend
cmd: |
pip install poetry
poetry install --only dev
poetry run pydocstyle rag_solution/ --count

# Frontend linting
- id: eslint
name: "ESLint (Frontend)"
working-directory: frontend
cmd: |
npm ci
npm run lint

- id: prettier
name: "Prettier Format Check"
working-directory: frontend
cmd: |
npm ci
npm run format:check

name: ${{ matrix.name }}

steps:
- name: πŸ“₯ Checkout code
uses: actions/checkout@v4

- name: 🐍 Set up Python 3.12
if: contains(matrix.id, 'ruff') || contains(matrix.id, 'mypy') || contains(matrix.id, 'pylint') || contains(matrix.id, 'pydocstyle') || contains(matrix.id, 'toml')

Check failure on line 100 in .github/workflows/01-lint.yml

View workflow job for this annotation

GitHub Actions / YAML Lint

100:81 [line-length] line too long (171 > 80 characters)
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'

- name: 🟒 Set up Node.js
if: contains(matrix.id, 'eslint') || contains(matrix.id, 'prettier')
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: πŸ” Install jq for JSON linting
if: matrix.id == 'jsonlint'
run: sudo apt-get update && sudo apt-get install -y jq

- name: πŸš€ Run ${{ matrix.name }}
working-directory: ${{ matrix.working-directory || '.' }}
run: ${{ matrix.cmd }}

- name: βœ… ${{ matrix.name }} passed
if: success()
run: echo "::notice::${{ matrix.name }} completed successfully"

- name: ❌ ${{ matrix.name }} failed
if: failure()
run: echo "::error::${{ matrix.name }} found issues"

lint-summary:
runs-on: ubuntu-latest
needs: lint
if: always()

steps:
- name: πŸ“Š Lint Summary
run: |
echo "## πŸ“Š Lint Results Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "All lint checks completed. Check individual jobs for details." >> $GITHUB_STEP_SUMMARY

Check failure on line 140 in .github/workflows/01-lint.yml

View workflow job for this annotation

GitHub Actions / YAML Lint

140:81 [line-length] line too long (102 > 80 characters)
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Benefits of Matrix Linting" >> $GITHUB_STEP_SUMMARY
echo "- βœ… **Parallel Execution**: All linters run simultaneously" >> $GITHUB_STEP_SUMMARY

Check failure on line 143 in .github/workflows/01-lint.yml

View workflow job for this annotation

GitHub Actions / YAML Lint

143:81 [line-length] line too long (99 > 80 characters)
echo "- βœ… **Clear Visibility**: Each linter shown separately in GitHub UI" >> $GITHUB_STEP_SUMMARY

Check failure on line 144 in .github/workflows/01-lint.yml

View workflow job for this annotation

GitHub Actions / YAML Lint

144:81 [line-length] line too long (108 > 80 characters)
echo "- βœ… **Fail-Fast Disabled**: See all failures, not just the first" >> $GITHUB_STEP_SUMMARY

Check failure on line 145 in .github/workflows/01-lint.yml

View workflow job for this annotation

GitHub Actions / YAML Lint

145:81 [line-length] line too long (105 > 80 characters)
echo "- βœ… **Easy Retry**: Can re-run individual linters" >> $GITHUB_STEP_SUMMARY

Check failure on line 146 in .github/workflows/01-lint.yml

View workflow job for this annotation

GitHub Actions / YAML Lint

146:81 [line-length] line too long (90 > 80 characters)
4 changes: 2 additions & 2 deletions .github/workflows/makefile-testing.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Makefile Testing

Check warning on line 1 in .github/workflows/makefile-testing.yml

View workflow job for this annotation

GitHub Actions / YAML Lint

1:1 [document-start] missing document start "---"

on:

Check warning on line 3 in .github/workflows/makefile-testing.yml

View workflow job for this annotation

GitHub Actions / YAML Lint

3:1 [truthy] truthy value should be one of [false, true]
pull_request:
branches: [ main, develop ]
paths:
- 'Makefile'
- 'tests/**'
- 'backend/**'
# Removed 'tests/**' and 'backend/**' to prevent unnecessary runs
# This workflow only tests Makefile targets, not feature changes
workflow_dispatch:

jobs:
Expand Down
Loading
Loading