Skip to content

Enforce f-string interpolation with Ruff#1088

Merged
markstos merged 1 commit into
mainfrom
automate-f-strings-check
Jul 9, 2026
Merged

Enforce f-string interpolation with Ruff#1088
markstos merged 1 commit into
mainfrom
automate-f-strings-check

Conversation

@markstos

@markstos markstos commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What changed?

Adds rule to express that we prefer f-strings, enforcing it with pre-commit hook and CI.

Why?

Saves time in the peer-review process from accidentally not using them and then
having them flagged by a human and fixed.

Limitations and Notes

Devs need to each install the pre-commit hook:

uv tool install pre-commit
pre-commit install

Applicable Issues

Inspired by PR #1075, where I used non-f-strings in a few places, a mistake
which which likely to be completed by myself or other new contributors without
automation.

@MelissaAutumn

Copy link
Copy Markdown
Member

I think the linting rule is fine, but I'm not a fan of pre-commit hooks. That maybe should be a team discussion on whether we adopt them.

Can you drop the pre-commit hook, the lint rule is good as-is. Thanks!

@Sancus

Sancus commented Jul 8, 2026

Copy link
Copy Markdown
Member

pre-commit hooks just kinda get in the way when doing local dev imo. Correct place for linting enforcement is in ci/cd on PR. It has to be there anyway since pre-commit hooks are unenforceable.

@markstos markstos force-pushed the automate-f-strings-check branch from 5901893 to 83eb899 Compare July 8, 2026 21:01
- Adds a pre-commit hook for ungoing enforcement.
- --force-exclude prevents generated migrations from causing problems.
@markstos markstos force-pushed the automate-f-strings-check branch from 83eb899 to 306f78f Compare July 8, 2026 21:04
@markstos

markstos commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

I've amended to remove the pre-commit hooks.

@MelissaAutumn MelissaAutumn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tyvm!!

@markstos markstos merged commit 13ae648 into main Jul 9, 2026
8 checks passed
@markstos markstos deleted the automate-f-strings-check branch July 9, 2026 18:41
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.

3 participants