telegram-mcp/.github/workflows/python-lint-format.yml

44 lines
No EOL
1.4 KiB
YAML

name: Python Lint & Format Check
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
lint-and-format:
name: Check Linting & Formatting
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black flake8
# Optional: If your linter needs project dependencies, install them:
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# Or for Poetry: if [ -f poetry.lock ]; then pip install poetry && poetry install --no-root; fi
# Or for PDM: if [ -f pdm.lock ]; then pip install pdm && pdm install --no-self; fi
- name: Lint with Flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
# Exit-zero treats all errors as warnings. Increase complexity threshold.
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Check for other issues, but don't fail the build (exit-zero)
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
- name: Check formatting with Black
run: |
black --check .