Skip to content

Conversation

TaKO8Ki
Copy link
Contributor

@TaKO8Ki TaKO8Ki commented Oct 1, 2025

Summary

Fixes #19837

Track quote usage across the joiner and parts to choose a safe f-string quote or skip the fix when both appear.

Test Plan

Add regression coverage to FLY002.py

@TaKO8Ki TaKO8Ki changed the title ['ruff'] Fix flynt f-string quoting for mixed quote joiners [ruff] Fix flynt f-string quoting for mixed quote joiners Oct 1, 2025
let adjusted_quote = match quote {
Quote::Single if has_single_quote && !has_double_quote => quote.opposite(),
Quote::Double if has_double_quote && !has_single_quote => quote.opposite(),
_ if has_double_quote && has_single_quote => return None,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the content includes both single quote and double quote, ruff skips FLY002 for now.

I will improve this logic in a separate pull request as we discussed here.

#20197 (review)

Copy link
Contributor

github-actions bot commented Oct 1, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser MichaReiser requested a review from ntBre October 3, 2025 07:41
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.

Thank you!

@ntBre ntBre changed the title [ruff] Fix flynt f-string quoting for mixed quote joiners [flynt] Fix f-string quoting for mixed quote joiners (FLY002) Oct 3, 2025
@ntBre ntBre added bug Something isn't working fixes Related to suggested fixes for violations labels Oct 3, 2025
@ntBre ntBre merged commit 542f080 into astral-sh:main Oct 3, 2025
38 checks passed
@TaKO8Ki TaKO8Ki deleted the fix-flynt-mixed-quote-join branch October 3, 2025 13:16
dcreager added a commit that referenced this pull request Oct 3, 2025
* origin/main:
  [`flake8-bugbear`] Include certain guaranteed-mutable expressions: tuples, generators, and assignment expressions (`B006`) (#20024)
  [`flake8-comprehensions`] Clarify fix safety documentation (`C413`) (#20640)
  [ty] improve base conda distinction from child conda (#20675)
  [`ruff`] Extend FA102 with listed PEP 585-compatible APIs (#20659)
  [`ruff`] Handle argfile expansion errors gracefully (#20691)
  [`flynt`] Fix f-string quoting for mixed quote joiners (`FLY002`) (#20662)
  [ty] Fix file root matching for `/`
  [ruff,ty] Enable tracing's `log` feature
  [`flake8-annotations`] Fix return type annotations to handle shadowed builtin symbols (`ANN201`, `ANN202`, `ANN204`, `ANN205`, `ANN206`) (#20612)
  Bump 0.13.3 (#20685)
  Update benchmarking CI for cargo-codspeed v4 (#20686)
  [ty] Support single-starred argument for overload call (#20223)
  [ty] `~T` should never be assignable to `T` (#20606)
  [`pylint`] Clarify fix safety to include left-hand hashability (`PLR6201`) (#20518)
  [ty] No union with `Unknown` for module-global symbols (#20664)
  [`ty`] Reject renaming files to start with slash in Playground (#20666)
  [ty] Enums: allow multiple aliases to point to the same member (#20669)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixes Related to suggested fixes for violations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FLY002 fix causes syntax error with double quotes in the strings
3 participants