Skip to content

[ruff] Lint for implicit concatenation of t-strings and f-strings #18396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dylwil3
Copy link
Collaborator

@dylwil3 dylwil3 commented May 30, 2025

As advertised!

Feel free to push back about the name, the decision to put this in the AST checker instead of working harder and putting it in the tokens checker, and anything else 😄

@dylwil3 dylwil3 added rule Implementing or modifying a lint rule preview Related to preview mode features python314 Related to Python 3.14 labels May 30, 2025
@MichaReiser
Copy link
Member

I think we should wait with adding this rule until it's clear that it isn't a syntax error. We otherwise risk having a deprecated rule even before 3.14 is released

@dylwil3
Copy link
Collaborator Author

dylwil3 commented May 30, 2025

I think we should wait with adding this rule until it's clear that it isn't a syntax error. We otherwise risk having a deprecated rule even before 3.14 is released

That's fine with me! Just thought I'd knock it out before I forgot - happy to close/turn this to draft until then.

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@MichaReiser
Copy link
Member

I love the rule itself. Thanks for implementing it so quickly

checker: &Checker,
string_like: StringLike,
) {
if !checker.target_version().supports_t_strings() {
Copy link
Member

Choose a reason for hiding this comment

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

I don't see much harm to run the rule even if the target version doesn't support t strings

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess the issue is that the user would also see a version specific syntax error. But that's fine I guess?

@dylwil3
Copy link
Collaborator Author

dylwil3 commented May 30, 2025

I think the mkdocs test fails because it's testing the syntax of the docs using Python 3.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Related to preview mode features python314 Related to Python 3.14 rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants