diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-05-18 07:53:43 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-05-18 07:53:43 +0800 |
commit | b4b238057e7913c93245b484bdd50131dafd71f3 (patch) | |
tree | a3394cfe902ce7edd07c89420c21c13274a2d295 | |
parent | a7c5d887e943aa51f2270e517954c024a8c01500 (diff) | |
download | gitpython-b4b238057e7913c93245b484bdd50131dafd71f3.tar.gz |
Revert "Remove flake8 linting in favor of `black` formatting"
This reverts commit a7c5d887e943aa51f2270e517954c024a8c01500.
-rw-r--r-- | .flake8 | 35 | ||||
-rw-r--r-- | .github/workflows/pythonpackage.yml | 4 | ||||
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | git/__init__.py | 1 | ||||
-rw-r--r-- | git/cmd.py | 2 | ||||
-rw-r--r-- | git/compat.py | 1 | ||||
-rw-r--r-- | git/index/__init__.py | 1 | ||||
-rw-r--r-- | git/objects/__init__.py | 1 | ||||
-rw-r--r-- | git/refs/__init__.py | 1 | ||||
-rw-r--r-- | git/repo/__init__.py | 1 | ||||
-rw-r--r-- | requirements-dev.txt | 7 | ||||
-rw-r--r-- | test-requirements.txt | 5 |
12 files changed, 59 insertions, 6 deletions
diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..c55fe35d --- /dev/null +++ b/.flake8 @@ -0,0 +1,35 @@ +[flake8] +show-source = True +count= True +statistics = True +# E265 = comment blocks like @{ section, which it can't handle +# E266 = too many leading '#' for block comment +# E731 = do not assign a lambda expression, use a def +# W293 = Blank line contains whitespace +# W504 = Line break after operator +# E704 = multiple statements in one line - used for @override +# TC002 = move third party import to TYPE_CHECKING +# ANN = flake8-annotations +# TC, TC2 = flake8-type-checking +# D = flake8-docstrings + +# select = C,E,F,W ANN, TC, TC2 # to enable code. Disabled if not listed, including builtin codes +enable-extensions = TC, TC2 # only needed for extensions not enabled by default + +ignore = E265,E266,E731,E704, + W293, W504, + ANN0 ANN1 ANN2, + TC002, + TC0, TC1, TC2 + # B, + A, + D, + RST, RST3 +max-line-length = 120 + +exclude = .tox,.venv,build,dist,doc,git/ext/,test + +rst-roles = # for flake8-RST-docstrings + attr,class,func,meth,mod,obj,ref,term,var # used by sphinx + +min-python-version = 3.7.0 diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index bcb47008..881f2ec5 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -44,10 +44,10 @@ jobs: # and cause subsequent tests to fail cat test/fixtures/.gitconfig >> ~/.gitconfig - - name: Lint with Black + - name: Lint with flake8 run: | set -x - black --check . + flake8 - name: Check types with mypy # 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. Ensure testing libraries are installed. In the root directory, run: `pip install -r test-requirements.txt` +To lint, run: `flake8` + To typecheck, run: `mypy -p git` To test, run: `pytest` -Configurations for mypy, pytest and coverage.py are in ./pyproject.toml. +Configuration for flake8 is in the ./.flake8 file. -Run `black` for formatting. +Configurations for mypy, pytest and coverage.py are in ./pyproject.toml. The same linting and testing will also be performed against different supported python versions upon submitting a pull request (or on each push if you have a fork with a "main" branch and actions enabled). diff --git a/git/__init__.py b/git/__init__.py index 209a4d90..3f26886f 100644 --- a/git/__init__.py +++ b/git/__init__.py @@ -3,6 +3,7 @@ # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php +# flake8: noqa # @PydevCodeAnalysisIgnore from git.exc import * # @NoMove @IgnorePep8 import inspect @@ -947,7 +947,7 @@ class Git(LazyMixin): ) else: cmd_not_found_exception = ( - FileNotFoundError + FileNotFoundError # NOQA # exists, flake8 unknown @UndefinedVariable ) # end handle diff --git a/git/compat.py b/git/compat.py index 20e6b979..e7ef28c3 100644 --- a/git/compat.py +++ b/git/compat.py @@ -5,6 +5,7 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php """utilities to help provide compatibility with python 3""" +# flake8: noqa import locale import os diff --git a/git/index/__init__.py b/git/index/__init__.py index e50e4f53..96b721f0 100644 --- a/git/index/__init__.py +++ b/git/index/__init__.py @@ -1,3 +1,4 @@ """Initialize the index package""" +# flake8: noqa from .base import * from .typ import * diff --git a/git/objects/__init__.py b/git/objects/__init__.py index 01a6395b..d2e1e53a 100644 --- a/git/objects/__init__.py +++ b/git/objects/__init__.py @@ -1,6 +1,7 @@ """ Import all submodules main classes into the package space """ +# flake8: noqa import inspect from .base import * diff --git a/git/refs/__init__.py b/git/refs/__init__.py index c17856ae..1486dffe 100644 --- a/git/refs/__init__.py +++ b/git/refs/__init__.py @@ -1,3 +1,4 @@ +# flake8: noqa # import all modules in order, fix the names they require from .symbolic import * from .reference import * diff --git a/git/repo/__init__.py b/git/repo/__init__.py index 0ca758cb..23c18db8 100644 --- a/git/repo/__init__.py +++ b/git/repo/__init__.py @@ -1,2 +1,3 @@ """Initialize the Repo package""" +# flake8: noqa from .base import Repo as Repo diff --git a/requirements-dev.txt b/requirements-dev.txt index 96b65551..f3aad629 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,6 +3,13 @@ # libraries for additional local testing/linting - to be added to test-requirements.txt when all pass
+flake8-type-checking;python_version>="3.8" # checks for TYPE_CHECKING only imports
+# flake8-annotations # checks for presence of type annotations
+# flake8-rst-docstrings # checks docstrings are valid RST
+# flake8-builtins # warns about shadowing builtin names
+# flake8-pytest-style
+
+# pytest-flake8
pytest-icdiff
# pytest-profiling
diff --git a/test-requirements.txt b/test-requirements.txt index c48a5856..53d8e606 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,10 @@ ddt>=1.1.1, !=1.4.3 mypy -black +flake8 +flake8-bugbear +flake8-comprehensions +flake8-typing-imports virtualenv |