Skip to content

Add actions to run black, flake, and pytest #4

Add actions to run black, flake, and pytest

Add actions to run black, flake, and pytest #4

Workflow file for this run

name: linter
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint black flake8
- name: Code formatting using black
run: |
black --check .
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# E203 and W503 are not compatible with black (and pep8)
flake8 . --count --max-complexity=10 --max-line-length=127 --statistics --ignore=E203,W503