Skip to content

Commit f8ec572

Browse files
authored
ci: Move flake8 config into pyproject.toml (#4185)
Consolidate configuration into `pyproject.toml`.
1 parent b7f4a96 commit f8ec572

File tree

3 files changed

+50
-25
lines changed

3 files changed

+50
-25
lines changed

.flake8

-21
This file was deleted.

pyproject.toml

+46-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#
2+
# Tool: Black
3+
#
4+
15
[tool.black]
26
# 'extend-exclude' excludes files or directories in addition to the defaults
37
extend-exclude = '''
@@ -9,6 +13,11 @@ extend-exclude = '''
913
)
1014
'''
1115

16+
17+
#
18+
# Tool: Coverage
19+
#
20+
1221
[tool.coverage.run]
1322
branch = true
1423
omit = [
@@ -22,6 +31,10 @@ exclude_also = [
2231
"if TYPE_CHECKING:",
2332
]
2433

34+
#
35+
# Tool: Pytest
36+
#
37+
2538
[tool.pytest.ini_options]
2639
addopts = "-vvv -rfEs -s --durations=5 --cov=./sentry_sdk --cov-branch --cov-report= --tb=short --junitxml=.junitxml"
2740
asyncio_mode = "strict"
@@ -34,6 +47,10 @@ markers = [
3447
verbose = true
3548
nobeep = true
3649

50+
#
51+
# Tool: Mypy
52+
#
53+
3754
[tool.mypy]
3855
allow_redefinition = true
3956
check_untyped_defs = true
@@ -43,7 +60,7 @@ disallow_subclassing_any = true
4360
disallow_untyped_decorators = true
4461
disallow_untyped_defs = true
4562
no_implicit_optional = true
46-
python_version = "3.11"
63+
python_version = "3.11"
4764
strict_equality = true
4865
strict_optional = true
4966
warn_redundant_casts = true
@@ -165,3 +182,31 @@ ignore_missing_imports = true
165182
[[tool.mypy.overrides]]
166183
module = "grpc.*"
167184
ignore_missing_imports = true
185+
186+
#
187+
# Tool: Flake8
188+
#
189+
190+
[tool.flake8]
191+
extend-ignore = [
192+
# Handled by black (Whitespace before ':' -- handled by black)
193+
"E203",
194+
# Handled by black (Line too long)
195+
"E501",
196+
# Sometimes not possible due to execution order (Module level import is not at top of file)
197+
"E402",
198+
# I don't care (Do not assign a lambda expression, use a def)
199+
"E731",
200+
# does not apply to Python 2 (redundant exception types by flake8-bugbear)
201+
"B014",
202+
# I don't care (Lowercase imported as non-lowercase by pep8-naming)
203+
"N812",
204+
# is a worse version of and conflicts with B902 (first argument of a classmethod should be named cls)
205+
"N804",
206+
]
207+
extend-exclude = ["checkouts", "lol*"]
208+
exclude = [
209+
# gRCP generated files
210+
"grpc_test_service_pb2.py",
211+
"grpc_test_service_pb2_grpc.py",
212+
]

requirements-linting.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
mypy
22
black
3-
flake8==5.0.4 # flake8 depends on pyflakes>=3.0.0 and this dropped support for Python 2 "# type:" comments
3+
flake8==5.0.4
4+
flake8-pyproject # Flake8 plugin to support configuration in pyproject.toml
5+
flake8-bugbear # Flake8 plugin
6+
pep8-naming # Flake8 plugin
47
types-certifi
58
types-protobuf
69
types-gevent
@@ -11,8 +14,6 @@ types-webob
1114
opentelemetry-distro
1215
pymongo # There is no separate types module.
1316
loguru # There is no separate types module.
14-
flake8-bugbear
15-
pep8-naming
1617
pre-commit # local linting
1718
httpcore
1819
launchdarkly-server-sdk

0 commit comments

Comments
 (0)