← 返回首页
Revert "Remove flake8 linting in favor of `black` formatting" · gitpython-developers/GitPython@b4b2380 · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Commit b4b2380

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

12 files changed

Lines changed: 59 additions & 6 deletions

File tree

‎.flake8‎

Lines changed: 35 additions & 0 deletions
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‎

Lines changed: 2 additions & 2 deletions
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‎

Lines changed: 4 additions & 2 deletions
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‎

Lines changed: 1 addition & 0 deletions
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‎

Lines changed: 1 addition & 1 deletion
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‎

Lines changed: 1 addition & 0 deletions
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‎

Lines changed: 1 addition & 0 deletions
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‎

Lines changed: 1 addition & 0 deletions
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‎

Lines changed: 1 addition & 0 deletions
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‎

Lines changed: 1 addition & 0 deletions
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

0 commit comments

Comments
 (0)

Footer

© 2026 GitHub, Inc.