@@ -0,0 +1,35 @@ | |||
| 1 | + [flake8] | ||
| 2 | + show-source = True | ||
| 3 | + count= True | ||
| 4 | + statistics = True | ||
| 5 | + # E265 = comment blocks like @{ section, which it can't handle | ||
| 6 | + # E266 = too many leading '#' for block comment | ||
| 7 | + # E731 = do not assign a lambda expression, use a def | ||
| 8 | + # W293 = Blank line contains whitespace | ||
| 9 | + # W504 = Line break after operator | ||
| 10 | + # E704 = multiple statements in one line - used for @override | ||
| 11 | + # TC002 = move third party import to TYPE_CHECKING | ||
| 12 | + # ANN = flake8-annotations | ||
| 13 | + # TC, TC2 = flake8-type-checking | ||
| 14 | + # D = flake8-docstrings | ||
| 15 | + | ||
| 16 | + # select = C,E,F,W ANN, TC, TC2 # to enable code. Disabled if not listed, including builtin codes | ||
| 17 | + enable-extensions = TC, TC2 # only needed for extensions not enabled by default | ||
| 18 | + | ||
| 19 | + ignore = E265,E266,E731,E704, | ||
| 20 | + W293, W504, | ||
| 21 | + ANN0 ANN1 ANN2, | ||
| 22 | + TC002, | ||
| 23 | + TC0, TC1, TC2 | ||
| 24 | + # B, | ||
| 25 | + A, | ||
| 26 | + D, | ||
| 27 | + RST, RST3 | ||
| 28 | + max-line-length = 120 | ||
| 29 | + | ||
| 30 | + exclude = .tox,.venv,build,dist,doc,git/ext/,test | ||
| 31 | + | ||
| 32 | + rst-roles = # for flake8-RST-docstrings | ||
| 33 | + attr,class,func,meth,mod,obj,ref,term,var # used by sphinx | ||
| 34 | + | ||
| 35 | + min-python-version = 3.7.0 | ||
@@ -44,10 +44,10 @@ jobs: | |||
| 44 | 44 | # and cause subsequent tests to fail | |
| 45 | 45 | cat test/fixtures/.gitconfig >> ~/.gitconfig | |
| 46 | 46 | ||
| 47 | - - name: Lint with Black | ||
| 47 | + - name: Lint with flake8 | ||
| 48 | 48 | run: | | |
| 49 | 49 | set -x | |
| 50 | - black --check . | ||
| 50 | + flake8 | ||
| 51 | 51 | ||
| 52 | 52 | - name: Check types with mypy | |
| 53 | 53 | # With new versions of pypi new issues might arise. This is a problem if there is nobody able to fix them, | |
@@ -107,13 +107,15 @@ with MINGW's. | |||
| 107 | 107 | Ensure testing libraries are installed. | |
| 108 | 108 | In the root directory, run: `pip install -r test-requirements.txt` | |
| 109 | 109 | ||
| 110 | + To lint, run: `flake8` | ||
| 111 | + | ||
| 110 | 112 | To typecheck, run: `mypy -p git` | |
| 111 | 113 | ||
| 112 | 114 | To test, run: `pytest` | |
| 113 | 115 | ||
| 114 | - Configurations for mypy, pytest and coverage.py are in ./pyproject.toml. | ||
| 116 | + Configuration for flake8 is in the ./.flake8 file. | ||
| 115 | 117 | ||
| 116 | - Run `black` for formatting. | ||
| 118 | + Configurations for mypy, pytest and coverage.py are in ./pyproject.toml. | ||
| 117 | 119 | ||
| 118 | 120 | The same linting and testing will also be performed against different supported python versions | |
| 119 | 121 | upon submitting a pull request (or on each push if you have a fork with a "main" branch and actions enabled). | |
@@ -3,6 +3,7 @@ | |||
| 3 | 3 | # | |
| 4 | 4 | # This module is part of GitPython and is released under | |
| 5 | 5 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php | |
| 6 | + # flake8: noqa | ||
| 6 | 7 | # @PydevCodeAnalysisIgnore | |
| 7 | 8 | from git.exc import * # @NoMove @IgnorePep8 | |
| 8 | 9 | import inspect | |
@@ -947,7 +947,7 @@ def execute( | |||
| 947 | 947 | ) | |
| 948 | 948 | else: | |
| 949 | 949 | cmd_not_found_exception = ( | |
| 950 | - FileNotFoundError | ||
| 950 | + FileNotFoundError # NOQA # exists, flake8 unknown @UndefinedVariable | ||
| 951 | 951 | ) | |
| 952 | 952 | # end handle | |
| 953 | 953 | ||
@@ -5,6 +5,7 @@ | |||
| 5 | 5 | # This module is part of GitPython and is released under | |
| 6 | 6 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php | |
| 7 | 7 | """utilities to help provide compatibility with python 3""" | |
| 8 | + # flake8: noqa | ||
| 8 | 9 | ||
| 9 | 10 | import locale | |
| 10 | 11 | import os | |
@@ -1,3 +1,4 @@ | |||
| 1 | 1 | """Initialize the index package""" | |
| 2 | + # flake8: noqa | ||
| 2 | 3 | from .base import * | |
| 3 | 4 | from .typ import * | |
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | """ | |
| 2 | 2 | Import all submodules main classes into the package space | |
| 3 | 3 | """ | |
| 4 | + # flake8: noqa | ||
| 4 | 5 | import inspect | |
| 5 | 6 | ||
| 6 | 7 | from .base import * | |
@@ -1,3 +1,4 @@ | |||
| 1 | + # flake8: noqa | ||
| 1 | 2 | # import all modules in order, fix the names they require | |
| 2 | 3 | from .symbolic import * | |
| 3 | 4 | from .reference import * | |
@@ -1,2 +1,3 @@ | |||
| 1 | 1 | """Initialize the Repo package""" | |
| 2 | + # flake8: noqa | ||
| 2 | 3 | from .base import Repo as Repo | |
0 commit comments