Skip to content

ci: Move flake8 config into pyproject.toml #4185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .flake8

This file was deleted.

47 changes: 46 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#
# Tool: Black
#

[tool.black]
# 'extend-exclude' excludes files or directories in addition to the defaults
extend-exclude = '''
Expand All @@ -9,6 +13,11 @@ extend-exclude = '''
)
'''


#
# Tool: Coverage
#

[tool.coverage.run]
branch = true
omit = [
Expand All @@ -22,6 +31,10 @@ exclude_also = [
"if TYPE_CHECKING:",
]

#
# Tool: Pytest
#

[tool.pytest.ini_options]
addopts = "-vvv -rfEs -s --durations=5 --cov=./sentry_sdk --cov-branch --cov-report= --tb=short --junitxml=.junitxml"
asyncio_mode = "strict"
Expand All @@ -34,6 +47,10 @@ markers = [
verbose = true
nobeep = true

#
# Tool: Mypy
#

[tool.mypy]
allow_redefinition = true
check_untyped_defs = true
Expand All @@ -43,7 +60,7 @@ disallow_subclassing_any = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
no_implicit_optional = true
python_version = "3.11"
python_version = "3.11"
strict_equality = true
strict_optional = true
warn_redundant_casts = true
Expand Down Expand Up @@ -165,3 +182,31 @@ ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "grpc.*"
ignore_missing_imports = true

#
# Tool: Flake8
#

[tool.flake8]
extend-ignore = [
# Handled by black (Whitespace before ':' -- handled by black)
"E203",
# Handled by black (Line too long)
"E501",
# Sometimes not possible due to execution order (Module level import is not at top of file)
"E402",
# I don't care (Do not assign a lambda expression, use a def)
"E731",
# does not apply to Python 2 (redundant exception types by flake8-bugbear)
"B014",
# I don't care (Lowercase imported as non-lowercase by pep8-naming)
"N812",
# is a worse version of and conflicts with B902 (first argument of a classmethod should be named cls)
"N804",
]
extend-exclude = ["checkouts", "lol*"]
exclude = [
# gRCP generated files
"grpc_test_service_pb2.py",
"grpc_test_service_pb2_grpc.py",
]
7 changes: 4 additions & 3 deletions requirements-linting.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
mypy
black
flake8==5.0.4 # flake8 depends on pyflakes>=3.0.0 and this dropped support for Python 2 "# type:" comments
flake8==5.0.4
flake8-pyproject # Flake8 plugin to support configuration in pyproject.toml
flake8-bugbear # Flake8 plugin
pep8-naming # Flake8 plugin
types-certifi
types-protobuf
types-gevent
Expand All @@ -11,8 +14,6 @@ types-webob
opentelemetry-distro
pymongo # There is no separate types module.
loguru # There is no separate types module.
flake8-bugbear
pep8-naming
pre-commit # local linting
httpcore
launchdarkly-server-sdk
Expand Down
Loading