Skip to content

Conversation

@dylwil3
Copy link
Collaborator

@dylwil3 dylwil3 commented Sep 11, 2025

Our token-based rules and noqa extraction used an Indexer that kept track of f-string ranges but not t-strings. We've updated the Indexer and downstream uses thereof to handle both f-strings and t-strings.

Most of the diff is renaming and adding tests.

Note that much of the "new" logic gets to be naive because the lexer has already ensured that f and t-string "starts" are paired with their respective "ends", even amidst nesting and so on.

Finally: one could imagine wanting to know if a given interpolated string range corresponds to an f-string or a t-string, but I didn't find a place where we actually needed this.

Closes #20310

@dylwil3 dylwil3 added bug Something isn't working rule Implementing or modifying a lint rule suppression Related to supression of violations e.g. noqa python314 Related to Python 3.14 labels Sep 11, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 11, 2025

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.

Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

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

Nice, thank you! This looks good to me, I just had a few questions for my understanding and a couple of very minor nits.

@dylwil3 dylwil3 merged commit b6bd32d into astral-sh:main Sep 12, 2025
35 checks passed
@ntBre ntBre linked an issue Oct 3, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working python314 Related to Python 3.14 rule Implementing or modifying a lint rule suppression Related to supression of violations e.g. noqa

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ISC rules do not support t-strings COM819 false positive in t-string interpolation

2 participants