|
| 1 | +default_stages: [commit, push] |
| 2 | +exclude: (^.github/|^docs/|^images/) |
| 3 | + |
| 4 | +repos: |
| 5 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 6 | + rev: v4.4.0 |
| 7 | + hooks: |
| 8 | + - id: trailing-whitespace |
| 9 | + - id: end-of-file-fixer |
| 10 | + - id: check-yaml |
| 11 | + - id: check-added-large-files # prevent giant files from being committed |
| 12 | + - id: requirements-txt-fixer |
| 13 | + - id: mixed-line-ending |
| 14 | + args: ["--fix=lf"] |
| 15 | + description: Forces to replace line ending by the UNIX 'lf' character. |
| 16 | + |
| 17 | + # black |
| 18 | + - repo: https://github.com/psf/black |
| 19 | + rev: 22.12.0 |
| 20 | + hooks: |
| 21 | + - id: black |
| 22 | + - id: black-jupyter |
| 23 | + args: |
| 24 | + - --line-length=88 |
| 25 | + |
| 26 | + # isort |
| 27 | + - repo: https://github.com/pycqa/isort |
| 28 | + rev: 5.11.2 |
| 29 | + hooks: |
| 30 | + - id: isort |
| 31 | + args: ["--profile", "black"] |
| 32 | + description: Sorts imports in an alphabetical order |
| 33 | + |
| 34 | + # flake8 |
| 35 | + - repo: https://github.com/pycqa/flake8 |
| 36 | + rev: 4.0.1 |
| 37 | + hooks: |
| 38 | + - id: flake8 |
| 39 | + args: # arguments to configure flake8 |
| 40 | + # making isort line length compatible with black |
| 41 | + - "--max-line-length=88" |
| 42 | + - "--max-complexity=18" |
| 43 | + - "--select=B,C,E,F,W,T4,B9" |
| 44 | + |
| 45 | + # these are errors that will be ignored by flake8 |
| 46 | + # https://www.flake8rules.com/rules/{code}.html |
| 47 | + - "--ignore=E203,E501,W503,W605,E402" |
| 48 | + # E203 - Colons should not have any space before them. |
| 49 | + # Needed for list indexing |
| 50 | + # E501 - Line lengths are recommended to be no greater than 79 characters. |
| 51 | + # Needed as we conform to 88 |
| 52 | + # W503 - Line breaks should occur after the binary operator. |
| 53 | + # Needed because not compatible with black |
| 54 | + # W605 - a backslash-character pair that is not a valid escape sequence now |
| 55 | + # generates a DeprecationWarning. This will eventually become a SyntaxError. |
| 56 | + # Needed because we use \d as an escape sequence |
| 57 | + # E402 - Place module level import at the top. |
| 58 | + # Needed to prevent circular import error |
0 commit comments