Skip to content

Commit b4b2380

Browse files
committed
Revert "Remove flake8 linting in favor of black formatting"
This reverts commit a7c5d88.
1 parent a7c5d88 commit b4b2380

File tree

12 files changed

+59
-6
lines changed

12 files changed

+59
-6
lines changed

.flake8

+35
Original file line numberDiff line numberDiff line change
@@ -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

.github/workflows/pythonpackage.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ jobs:
4444
# and cause subsequent tests to fail
4545
cat test/fixtures/.gitconfig >> ~/.gitconfig
4646
47-
- name: Lint with Black
47+
- name: Lint with flake8
4848
run: |
4949
set -x
50-
black --check .
50+
flake8
5151
5252
- name: Check types with mypy
5353
# With new versions of pypi new issues might arise. This is a problem if there is nobody able to fix them,

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,15 @@ with MINGW's.
107107
Ensure testing libraries are installed.
108108
In the root directory, run: `pip install -r test-requirements.txt`
109109

110+
To lint, run: `flake8`
111+
110112
To typecheck, run: `mypy -p git`
111113

112114
To test, run: `pytest`
113115

114-
Configurations for mypy, pytest and coverage.py are in ./pyproject.toml.
116+
Configuration for flake8 is in the ./.flake8 file.
115117

116-
Run `black` for formatting.
118+
Configurations for mypy, pytest and coverage.py are in ./pyproject.toml.
117119

118120
The same linting and testing will also be performed against different supported python versions
119121
upon submitting a pull request (or on each push if you have a fork with a "main" branch and actions enabled).

git/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
6+
# flake8: noqa
67
# @PydevCodeAnalysisIgnore
78
from git.exc import * # @NoMove @IgnorePep8
89
import inspect

git/cmd.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ def execute(
947947
)
948948
else:
949949
cmd_not_found_exception = (
950-
FileNotFoundError
950+
FileNotFoundError # NOQA # exists, flake8 unknown @UndefinedVariable
951951
)
952952
# end handle
953953

git/compat.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# This module is part of GitPython and is released under
66
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
77
"""utilities to help provide compatibility with python 3"""
8+
# flake8: noqa
89

910
import locale
1011
import os

git/index/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
"""Initialize the index package"""
2+
# flake8: noqa
23
from .base import *
34
from .typ import *

git/objects/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Import all submodules main classes into the package space
33
"""
4+
# flake8: noqa
45
import inspect
56

67
from .base import *

git/refs/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# flake8: noqa
12
# import all modules in order, fix the names they require
23
from .symbolic import *
34
from .reference import *

git/repo/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""Initialize the Repo package"""
2+
# flake8: noqa
23
from .base import Repo as Repo

requirements-dev.txt

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33

44
# libraries for additional local testing/linting - to be added to test-requirements.txt when all pass
55

6+
flake8-type-checking;python_version>="3.8" # checks for TYPE_CHECKING only imports
7+
# flake8-annotations # checks for presence of type annotations
8+
# flake8-rst-docstrings # checks docstrings are valid RST
9+
# flake8-builtins # warns about shadowing builtin names
10+
# flake8-pytest-style
11+
12+
# pytest-flake8
613
pytest-icdiff
714
# pytest-profiling
815

test-requirements.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
ddt>=1.1.1, !=1.4.3
22
mypy
33

4-
black
4+
flake8
5+
flake8-bugbear
6+
flake8-comprehensions
7+
flake8-typing-imports
58

69
virtualenv
710

0 commit comments

Comments
 (0)