name: Lint

on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main, develop ]

jobs:
  lint:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: '3.10'

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install black isort ruff mypy

    - name: Check code formatting with black
      run: |
        black --check src/sollol tests/

    - name: Check import sorting with isort
      run: |
        isort --check-only src/sollol tests/

    - name: Lint with ruff
      run: |
        # Ruff is much faster and has no version compatibility issues
        # Ignore non-critical errors and false positives
        # F811: Redefinition of imports (intentional for conditional imports)
        # F823: Local variable referenced before assignment (false positive for module-level imports)
        # PLW0602/PLW0603: Global statement warnings (legitimate pattern for read-only/state management)
        ruff check src/sollol tests/ --ignore=E402,E501,E722,F401,F541,F811,F823,F841,PLW0602,PLW0603

    - name: Type check with mypy
      run: |
        mypy src/sollol --ignore-missing-imports
      continue-on-error: true
