From a2f11229ba702135b12837100969b087c2cbcf67 Mon Sep 17 00:00:00 2001 From: Noemi <45180344+unflxw@users.noreply.github.com> Date: Mon, 11 Mar 2024 14:38:07 +0100 Subject: [PATCH] Fix `ruff` and `mypy` warnings Fix deprecation warnings for `ruff` about invoking it as `ruff .` (instead of `ruff check .` and about configuring linting settings for it as `[tool.ruff]` in the `pyproject.toml` (instead of as `[tool.ruff.lint]`. Fix warning from `mypy` that enabling `Unpack` support is no longer necessary. These changes bring these tools in line with the expectations set by running them on GitHub. You may need to refresh your linting environment. Run `hatch prune` to delete your existing Hatch environments. --- pyproject.toml | 8 +++++--- src/appsignal/opentelemetry.py | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 887b3bc..d69035f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -94,16 +94,16 @@ dependencies = [ ] [tool.hatch.envs.lint.scripts] -typing = "mypy --enable-incomplete-feature=Unpack {args}" +typing = "mypy {args}" style = [ - "ruff {args:.}", + "ruff check {args:.}", "isort --check {args:.}", "black --check --diff {args:.}", ] fmt = [ "isort {args:.}", "black {args:.}", - "ruff --fix {args:.}", + "ruff check --fix {args:.}", ] all = [ "fmt", @@ -114,6 +114,8 @@ all = [ [tool.ruff] line-length = 90 extend-exclude = ["src/scripts/agent.py"] + +[tool.ruff.lint] select = [ "E", "W", "F", # flake8 (pycodestyle and pyflakes) "N", # pep8-naming diff --git a/src/appsignal/opentelemetry.py b/src/appsignal/opentelemetry.py index 69e04b2..f4afd3a 100644 --- a/src/appsignal/opentelemetry.py +++ b/src/appsignal/opentelemetry.py @@ -112,9 +112,9 @@ def start_opentelemetry(config: Config) -> None: # Configure OpenTelemetry request headers config request_headers = list_to_env_str(config.option("request_headers")) if request_headers: - os.environ[ - "OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_REQUEST" - ] = request_headers + os.environ["OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SERVER_REQUEST"] = ( + request_headers + ) opentelemetry_port = config.option("opentelemetry_port") _start_opentelemetry_tracer(opentelemetry_port)