Skip to content

Commit

Permalink
Add and configure pre-commit for ruff, flake8 and yapf
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens-Erik Weber authored and Jens-Erik Weber committed Sep 19, 2023
1 parent be735be commit 94da9e8
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[flake8]
max-line-length = 120
extend-ignore =
# closing bracket does not match visual indentation, caused by yapf
E124
# continuation line missing indentation or outdented
# doesn’t look wrong, formatted like this by yapf
E122
# E251 unexpected spaces around keyword / parameter equals, caused by yapf wrapping lines after “=”
E251

per-file-ignores =
# E501 line too long
*/migrations/*: E501

# F403 e. g. 'from .base_settings import *' used; unable to detect undefined names
# F405 x may be undefined, or defined from star imports
phi/*settings*: F403, F405

exclude =
local
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.290
hooks:
- id: ruff

- repo: https://github.com/pycqa/flake8
rev: '6.1.0' # pick a git hash / tag to point to
hooks:
- id: flake8

- repo: https://github.com/google/yapf
rev: 'v0.40.0'
hooks:
- id: yapf
name: yapf
description: "A formatter for Python files."
entry: yapf
args: [ -i ] # inplace
language: python
types: [ python ]

0 comments on commit 94da9e8

Please sign in to comment.