Skip to content
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

Preserve multiline implicit concatenated strings in docstring positions #15126

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Dec 23, 2024

Summary

This is a bug fix for #13928

I noticed this when writing up the black deviations document and was very confused until I realized... Oh, it's a docstring!

We failed to preserve multiline implicit concatenated
strings that can't be automatically joined in docstring positions:

def test():
  (
     r"This is a docstring"
     "and Ruff can't automatically join it"
  )

Test plan

Added formatter tests

@MichaReiser MichaReiser added formatter Related to the formatter preview Related to preview mode features labels Dec 23, 2024
@MichaReiser MichaReiser marked this pull request as ready for review December 23, 2024 15:41
Copy link
Contributor

github-actions bot commented Dec 23, 2024

ruff-ecosystem results

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

## Summary
This is a bug fix for #13928

We failed to preserve multiline implicit concatenated
strings that can't be automatically joined in docstring positions:

```py
def test():
  (
     r"This is a docstring"
     "and Ruff can't automatically join it"
  )
```

## Test plan
Added formatter tests
@MichaReiser MichaReiser force-pushed the micha/preserve-multiline-implicit-concatenated-string-in-docstrings branch from d9f0ce8 to edc3bb4 Compare December 23, 2024 15:52
@MichaReiser MichaReiser merged commit 1218bc6 into main Jan 3, 2025
21 checks passed
@MichaReiser MichaReiser deleted the micha/preserve-multiline-implicit-concatenated-string-in-docstrings branch January 3, 2025 09:27
dcreager added a commit that referenced this pull request Jan 3, 2025
* main:
  [`ruff`] Avoid reporting when `ndigits` is possibly negative (`RUF057`) (#15234)
  Attribute panics to the mdtests that cause them (#15241)
  Show errors for attempted fixes only when passed `--verbose` (#15237)
  [`RUF`] Add rule to detect empty literal in deque call (`RUF025`) (#15104)
  TD003: remove issue code length restriction (#15175)
  Preserve multiline implicit concatenated strings in docstring positions (#15126)
  [`pyflakes`] Ignore errors in `@no_type_check` string annotations (`F722`, `F821`) (#15215)
  style(AIR302): rename removed_airflow_plugin_extension as check_airflow_plugin_extension (#15233)
  [`pylint`] Re-implement `unreachable` (`PLW0101`) (#10891)
  refactor(AIR303): move duplicate qualified_name.to_string() to Diagnostic argument (#15220)
  Misc. clean up to rounding rules (#15231)
  Avoid syntax error when removing int over multiple lines (#15230)
  Migrate renovate config (#15228)
  Remove `Type::tuple` in favor of `TupleType::from_elements` (#15218)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter preview Related to preview mode features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants