Skip to content

Commit 70afe50

Browse files
committed
style: clear legacy ruff violations
1 parent 22663de commit 70afe50

9 files changed

Lines changed: 10 additions & 23 deletions

File tree

.github/workflows/test.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ jobs:
2525
run: uv sync --extra dev
2626

2727
- name: Ruff
28-
run: |
29-
uv run ruff check \
30-
src/openadapt_telemetry/posthog.py \
31-
src/openadapt_telemetry/__init__.py \
32-
tests/test_posthog.py
28+
run: uv run ruff check .
3329

3430
- name: Pytest
35-
run: PYTHONPATH=src uv run pytest -q tests/test_posthog.py
31+
run: PYTHONPATH=src uv run pytest -q

src/openadapt_telemetry/client.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
import platform
1111
import sys
1212
from pathlib import Path
13-
from typing import Any, Callable, Dict, Optional
13+
from typing import Any, Dict, Optional
1414

1515
import sentry_sdk
16-
from sentry_sdk.types import Event, Hint
1716

1817
from .config import TelemetryConfig, load_config
19-
from .privacy import create_before_send_filter, sanitize_path
18+
from .privacy import create_before_send_filter
2019

2120

2221
def is_running_from_executable() -> bool:

src/openadapt_telemetry/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from pathlib import Path
1616
from typing import Any, Optional
1717

18-
1918
# Default configuration values
2019
DEFAULTS = {
2120
"enabled": True,

src/openadapt_telemetry/decorators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import functools
1212
import time
13-
from typing import Any, Callable, Optional, TypeVar, Union
13+
from typing import Any, Callable, Optional, TypeVar
1414

1515
import sentry_sdk
1616

@@ -57,7 +57,7 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
5757
result = func(*args, **kwargs)
5858
transaction.set_status("ok")
5959
return result
60-
except Exception as e:
60+
except Exception:
6161
transaction.set_status("internal_error")
6262
raise
6363
finally:

src/openadapt_telemetry/privacy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import re
1313
from typing import Any, Dict, List, Optional, Set
1414

15-
1615
# Sensitive field names that should have their values redacted
1716
PII_DENYLIST: Set[str] = {
1817
# Authentication

tests/test_client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
"""Tests for telemetry client."""
22

33
import os
4-
from pathlib import Path
5-
from unittest.mock import MagicMock, patch
6-
7-
import pytest
4+
from unittest.mock import patch
85

96
from openadapt_telemetry.client import (
107
TelemetryClient,

tests/test_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import pytest
1010

1111
from openadapt_telemetry.config import (
12-
CONFIG_FILE,
1312
TelemetryConfig,
1413
_get_env_config,
1514
_load_config_file,

tests/test_decorators.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Tests for telemetry decorators."""
22

3-
import os
43
from unittest.mock import MagicMock, patch
54

65
import pytest
@@ -171,20 +170,20 @@ def teardown_method(self):
171170

172171
def test_basic_usage(self):
173172
"""Basic span usage should work."""
174-
with TelemetrySpan("test_op", "test_span") as span:
173+
with TelemetrySpan("test_op", "test_span"):
175174
result = 1 + 1
176175

177176
assert result == 2
178177

179178
def test_with_description(self):
180179
"""Span with description should work."""
181-
with TelemetrySpan("op", "name", description="Test description") as span:
180+
with TelemetrySpan("op", "name", description="Test description"):
182181
pass
183182

184183
def test_exception_handling(self):
185184
"""Exceptions should propagate through span."""
186185
with pytest.raises(ValueError, match="test"):
187-
with TelemetrySpan("op", "name") as span:
186+
with TelemetrySpan("op", "name"):
188187
raise ValueError("test")
189188

190189
def test_set_tag(self):

tests/test_privacy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Tests for privacy filtering and PII scrubbing."""
22

3-
import pytest
43

54
from openadapt_telemetry.privacy import (
65
is_sensitive_key,

0 commit comments

Comments
 (0)