Skip to content

Enable ruff pyupgrade (UP) lint rules#4940

Open
toroleapinc wants to merge 1 commit intoopen-telemetry:mainfrom
toroleapinc:feat/issue-4227-ruff-UP-rule
Open

Enable ruff pyupgrade (UP) lint rules#4940
toroleapinc wants to merge 1 commit intoopen-telemetry:mainfrom
toroleapinc:feat/issue-4227-ruff-UP-rule

Conversation

@toroleapinc
Copy link

Summary

Enable a subset of safe pyupgrade (UP) ruff rules that are compatible with the Python 3.8 target version:

  • UP011: Remove unnecessary parentheses from @lru_cache()
  • UP015: Remove redundant open() mode arguments
  • UP032: Replace .format() calls with f-strings
  • UP034: Remove extraneous parentheses
  • UP037: Remove unnecessary quoted annotations (in files with from __future__ import annotations)

All 42 violations were auto-fixed by ruff check --fix.

Not included (unsafe for py38 target): UP006, UP007, UP031, UP045 which require Python 3.9+/3.10+ syntax.

Part of #4227

Enable a subset of pyupgrade rules that are safe for the Python 3.8
target version:
- UP011: lru-cache-without-parameters
- UP015: redundant-open-modes
- UP032: f-string (replaces .format() calls)
- UP034: extraneous-parentheses
- UP037: quoted-annotation (removes unnecessary string quotes)

All 42 violations were auto-fixed by ruff.

Part of open-telemetry#4227

Signed-off-by: edvatar <88481784+toroleapinc@users.noreply.github.com>
@toroleapinc toroleapinc requested a review from a team as a code owner February 27, 2026 16:09
@linux-foundation-easycla
Copy link

CLA Not Signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant