Skip to content

Commit

Permalink
Fix ruff and mypy warnings
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
unflxw committed Mar 11, 2024
1 parent c4e5e5d commit a2f1122
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/appsignal/opentelemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a2f1122

Please sign in to comment.