- Remove the 50-error threshold that allowed type errors to pass - Require 0 type errors for CI to pass (aiming for full type safety) - Only check src/ directory (tests have legacy issues to fix separately) - Update error messages to be clearer about requirements - Add helpful hint about running pyright locally This ensures all new code maintains strict type safety and prevents accumulation of type errors over time. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
106 lines
No EOL
3.1 KiB
YAML
106 lines
No EOL
3.1 KiB
YAML
name: MCP Server Formatting and Linting
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'mcp_server/**'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
format-and-lint:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v4
|
|
with:
|
|
enable-cache: true
|
|
|
|
- name: Set up Python
|
|
run: uv python install
|
|
|
|
- name: Install MCP server dependencies
|
|
run: |
|
|
cd mcp_server
|
|
uv sync --extra dev
|
|
|
|
- name: Add ruff to dependencies
|
|
run: |
|
|
cd mcp_server
|
|
uv add --group dev "ruff>=0.7.1"
|
|
|
|
- name: Check code formatting with ruff
|
|
run: |
|
|
cd mcp_server
|
|
echo "🔍 Checking code formatting..."
|
|
uv run ruff format --check --diff .
|
|
if [ $? -eq 0 ]; then
|
|
echo "✅ Code formatting is correct"
|
|
else
|
|
echo "❌ Code formatting issues found"
|
|
echo "💡 Run 'ruff format .' in mcp_server/ to fix formatting"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Run ruff linting
|
|
run: |
|
|
cd mcp_server
|
|
echo "🔍 Running ruff linting..."
|
|
uv run ruff check --output-format=github .
|
|
|
|
- name: Add pyright for type checking
|
|
run: |
|
|
cd mcp_server
|
|
uv add --group dev pyright
|
|
|
|
- name: Install graphiti-core for type checking
|
|
run: |
|
|
cd mcp_server
|
|
# Install graphiti-core as it's needed for type checking
|
|
uv add --group dev "graphiti-core>=0.16.0"
|
|
|
|
- name: Run type checking with pyright
|
|
run: |
|
|
cd mcp_server
|
|
echo "🔍 Running type checking on src/ directory..."
|
|
# Run pyright and capture output (only check src/ for now, tests have legacy issues)
|
|
if uv run pyright src/ > pyright_output.txt 2>&1; then
|
|
echo "✅ Type checking passed with no errors"
|
|
cat pyright_output.txt
|
|
else
|
|
echo "❌ Type checking found issues:"
|
|
cat pyright_output.txt
|
|
# Count errors
|
|
error_count=$(grep -c "error:" pyright_output.txt || echo "0")
|
|
warning_count=$(grep -c "warning:" pyright_output.txt || echo "0")
|
|
echo ""
|
|
echo "📊 Type checking summary:"
|
|
echo " - Errors: $error_count"
|
|
echo " - Warnings: $warning_count"
|
|
echo ""
|
|
echo "❌ Type checking failed. All type errors must be fixed."
|
|
echo "💡 Run 'uv run pyright src/' in mcp_server/ to see type errors"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Check import sorting
|
|
run: |
|
|
cd mcp_server
|
|
echo "🔍 Checking import sorting..."
|
|
uv run ruff check --select I --output-format=github .
|
|
|
|
- name: Summary
|
|
if: success()
|
|
run: |
|
|
echo "✅ All formatting and linting checks passed!"
|
|
echo "✅ Code formatting: OK"
|
|
echo "✅ Ruff linting: OK"
|
|
echo "✅ Type checking: OK"
|
|
echo "✅ Import sorting: OK" |