diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7ec62a8f37..f8fb5174fc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,9 +1,14 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: + # ruff-pre-commit is not using tool.ruff.include setting, + # so `files` need to be specified here. + # https://github.com/astral-sh/ruff-pre-commit/issues/71 - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.13.2 + rev: v0.14.10 hooks: - id: ruff-check args: [--fix] + files: ^(sentry_sdk/|tests/) - id: ruff-format + files: ^(sentry_sdk/|tests/) diff --git a/pyproject.toml b/pyproject.toml index 2038ccd81f..4598f0f1fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -196,6 +196,9 @@ ignore_missing_imports = true # Target Python 3.7+ (minimum version supported by ruff) target-version = "py37" +# Include files and directories +include = ["sentry_sdk/**/*.py", "tests/**/*.py"] + # Exclude files and directories extend-exclude = [ "*_pb2.py", # Protocol Buffer files (covers all pb2 files including grpc_test_service_pb2.py) diff --git a/tox.ini b/tox.ini index 26166555c1..7dfe54c758 100644 --- a/tox.ini +++ b/tox.ini @@ -925,6 +925,5 @@ commands = [testenv:linters] commands = - ruff check tests sentry_sdk - ruff format --check tests sentry_sdk + pre-commit run --all-files mypy sentry_sdk