Skip to content

Enable RUF010 and RUF015 ruff rules#844

Merged
johanlundberg merged 4 commits intomainfrom
ylle-more-ruf-rules
Feb 13, 2026
Merged

Enable RUF010 and RUF015 ruff rules#844
johanlundberg merged 4 commits intomainfrom
ylle-more-ruf-rules

Conversation

@helylle
Copy link
Contributor

@helylle helylle commented Feb 12, 2026

Enable RUF010 and RUF015 ruff rules

Enable two previously-ignored ruff rules and fix all violations across the codebase.

Changes

RUF010 — Use conversion flag in f-strings

Instead of calling str(), repr(), or ascii() inside f-strings, use the !s, !r, or !a conversion flags.

Before: f"value: {str(x)}"
After: f"value: {x!s}"

RUF015 — Prefer next(iter(...)) over single-element slice

Instead of creating an intermediate list just to get the first element (list(x)[0]), use next(iter(x)) which is O(1) and avoids allocating a list.

Before: list(items)[0]
After: next(iter(items))

Scope

  • 73 files changed across the codebase
  • Removed RUF010 and RUF015 from the ignore list in ruff.toml
  • All fixes are mechanical/automated with manual review

@helylle helylle marked this pull request as ready for review February 12, 2026 16:14
@sonarqubecloud
Copy link

@johanlundberg johanlundberg merged commit 7f39e59 into main Feb 13, 2026
12 checks passed
@johanlundberg johanlundberg deleted the ylle-more-ruf-rules branch February 13, 2026 09:56
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.

2 participants