From 8d5cb7577ac5d6e4099021c329e3b3f19db92cb3 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 21 Mar 2025 14:01:47 +0100 Subject: [PATCH 1/2] comments --- pyproject.toml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 25d9b84860..7ecb0fd29d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,7 @@ +# +# Tool: Black +# + [tool.black] # 'extend-exclude' excludes files or directories in addition to the defaults extend-exclude = ''' @@ -9,6 +13,11 @@ extend-exclude = ''' ) ''' + +# +# Tool: Coverage +# + [tool.coverage.run] branch = true omit = [ @@ -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" @@ -34,6 +47,10 @@ markers = [ verbose = true nobeep = true +# +# Tool: Mypy +# + [tool.mypy] allow_redefinition = true check_untyped_defs = true @@ -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 From 4ec621ba2b160bec6c7088389fdfc07cc17e0e25 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 21 Mar 2025 14:21:42 +0100 Subject: [PATCH 2/2] Moved flake8 config into pyproject.toml --- .flake8 | 21 --------------------- pyproject.toml | 28 ++++++++++++++++++++++++++++ requirements-linting.txt | 7 ++++--- 3 files changed, 32 insertions(+), 24 deletions(-) delete mode 100644 .flake8 diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 8610e09241..0000000000 --- a/.flake8 +++ /dev/null @@ -1,21 +0,0 @@ -[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 diff --git a/pyproject.toml b/pyproject.toml index 7ecb0fd29d..5e16b30793 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -182,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", +] diff --git a/requirements-linting.txt b/requirements-linting.txt index 4255685b5e..20db2151d0 100644 --- a/requirements-linting.txt +++ b/requirements-linting.txt @@ -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 @@ -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