Skip to content

Flake8

DEPRECATION: Use Flakehell instead

Flake8 doesn't support pyproject.toml, which is becoming the standard, so I suggest using Flakehell instead.

Flake8 is a style guide enforcement tool. Its configuration is stored in setup.cfg, tox.ini or .flake8.

File: .flake8

[flake8]
# ignore = E203, E266, E501, W503, F403, F401
max-line-length = 88
# max-complexity = 18
# select = B,C,E,F,W,T4,B9

You can use it both with:

  • Pre-commit:

    File: .pre-commit-config.yaml

    repos:
    - repo: https://gitlab.com/pycqa/flake8
      rev: master
      hooks:
        - id: flake8
    
    • Github Actions:

    File: .github/workflows/lint.yml

    name: Lint
    
    on: [push, pull_request]
    
    jobs:
      Flake8:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
          - uses: actions/setup-python@v2
          - name: Flake8
            uses: cclauss/GitHub-Action-for-Flake8@v0.5.0
    

References