Skip to content

Commit e10e7ac

Browse files
Prhmmaxrmx
andauthored
chore: bump ruff to 0.14.1 and fix new lint warnings (fixes #4780) (#4782)
* chore: bump ruff to 0.14.1 and fix new lint warnings (fixes #4780) - Update ruff version in dev-requirements.txt and .pre-commit-config.yaml - Add noqa for intentional conditional imports flagged by newer ruff * changelog update --------- Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
1 parent c646674 commit e10e7ac

File tree

8 files changed

+21
-17
lines changed

8 files changed

+21
-17
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
33
# Ruff version.
4-
rev: v0.6.9
4+
rev: v0.14.1
55
hooks:
66
# Run the linter.
77
- id: ruff

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414

1515
- docs: Added sqlcommenter example
1616
([#4734](https://github.com/open-telemetry/opentelemetry-python/pull/4734))
17+
- build: bump ruff to 0.14.1
18+
([#4782](https://github.com/open-telemetry/opentelemetry-python/pull/4782))
1719

1820
## Version 1.38.0/0.59b0 (2025-10-16)
1921

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ psutil==5.9.6
1717
GitPython==3.1.41
1818
pre-commit==3.7.0; python_version >= '3.9'
1919
pre-commit==3.5.0; python_version < '3.9'
20-
ruff==0.6.9
20+
ruff==0.14.1

docs/examples/django/manage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ def main():
3030
DjangoInstrumentor().instrument()
3131

3232
try:
33-
from django.core.management import execute_from_command_line
33+
from django.core.management import ( # noqa: PLC0415
34+
execute_from_command_line,
35+
)
3436
except ImportError as exc:
3537
raise ImportError(
3638
"Couldn't import Django. Are you sure it's installed and "

opentelemetry-api/tests/propagators/test_propagators.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_propagators(propagators):
4545
)
4646

4747
# pylint: disable=import-outside-toplevel
48-
import opentelemetry.propagate
48+
import opentelemetry.propagate # noqa: PLC0415
4949

5050
reload(opentelemetry.propagate)
5151

@@ -66,7 +66,7 @@ def test_propagators(propagators):
6666
)
6767

6868
# pylint: disable=import-outside-toplevel
69-
import opentelemetry.propagate
69+
import opentelemetry.propagate # noqa: PLC0415
7070

7171
reload(opentelemetry.propagate)
7272

@@ -89,7 +89,7 @@ def test_propagators(propagators):
8989
)
9090

9191
# pylint: disable=import-outside-toplevel
92-
import opentelemetry.propagate
92+
import opentelemetry.propagate # noqa: PLC0415
9393

9494
reload(opentelemetry.propagate)
9595

@@ -141,7 +141,7 @@ def test_propagators(propagators):
141141
)
142142

143143
# pylint: disable=import-outside-toplevel
144-
import opentelemetry.propagate
144+
import opentelemetry.propagate # noqa: PLC0415
145145

146146
reload(opentelemetry.propagate)
147147

@@ -151,7 +151,7 @@ def test_propagators(propagators):
151151
def test_composite_propagators_error(self):
152152
with self.assertRaises(ValueError) as cm:
153153
# pylint: disable=import-outside-toplevel
154-
import opentelemetry.propagate
154+
import opentelemetry.propagate # noqa: PLC0415
155155

156156
reload(opentelemetry.propagate)
157157

opentelemetry-sdk/tests/metrics/exponential_histogram/test_exponential_bucket_histogram_aggregation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,9 +1194,9 @@ def collect_and_validate(values, histogram) -> None:
11941194
# pylint: disable=chained-comparison
11951195
if value > lower_bound and value <= upper_bound:
11961196
matches += 1
1197-
assert (
1198-
matches == count
1199-
), f"index: {index}, count: {count}, scale: {scale}, lower_bound: {lower_bound}, upper_bound: {upper_bound}, matches: {matches}"
1197+
assert matches == count, (
1198+
f"index: {index}, count: {count}, scale: {scale}, lower_bound: {lower_bound}, upper_bound: {upper_bound}, matches: {matches}"
1199+
)
12001200

12011201
assert sum(buckets) + result.zero_count == len(values)
12021202
assert result.sum == sum(values)

opentelemetry-sdk/tests/metrics/integration_test/test_cpu_time.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ def cpu_time_callback(
233233
)
234234

235235
def test_cpu_time_generator(self):
236-
def cpu_time_generator() -> (
237-
Generator[Iterable[Observation], None, None]
238-
):
236+
def cpu_time_generator() -> Generator[
237+
Iterable[Observation], None, None
238+
]:
239239
options = yield
240240
while True:
241241
self.assertIsInstance(options, CallbackOptions)

opentelemetry-sdk/tests/metrics/test_import.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_import_init(self):
2424
"""
2525

2626
with self.assertNotRaises(Exception):
27-
from opentelemetry.sdk.metrics import ( # noqa: F401
27+
from opentelemetry.sdk.metrics import ( # noqa: F401, PLC0415
2828
Counter,
2929
Histogram,
3030
Meter,
@@ -42,7 +42,7 @@ def test_import_export(self):
4242
"""
4343

4444
with self.assertNotRaises(Exception):
45-
from opentelemetry.sdk.metrics.export import ( # noqa: F401
45+
from opentelemetry.sdk.metrics.export import ( # noqa: F401, PLC0415
4646
AggregationTemporality,
4747
ConsoleMetricExporter,
4848
DataPointT,
@@ -69,7 +69,7 @@ def test_import_view(self):
6969
"""
7070

7171
with self.assertNotRaises(Exception):
72-
from opentelemetry.sdk.metrics.view import ( # noqa: F401
72+
from opentelemetry.sdk.metrics.view import ( # noqa: F401, PLC0415
7373
Aggregation,
7474
DefaultAggregation,
7575
DropAggregation,

0 commit comments

Comments
 (0)