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

Stabilize quote-style preserve #9922

Merged
merged 1 commit into from
Feb 12, 2024
Merged

Conversation

MichaReiser
Copy link
Member

This PR removes the --preview requirement for quote-style: preserve and changes the semantics of
the style to apply to all strings (including triple quoted and doc-strings).

The motivation for changing the semantic to apply to all strings is:

  • The option is intended as a replacement for black's --skip-string-normalization that applies to all strings
  • The option is intended for projects that can't enforce a consistent quote style. These are mainly projects that want to use a formatter but can't agree on a single quote style or changing all strings leads to too large diffs. Allowing these users to use a formatter is more important than being opinionated on the quote style
  • We received reports that users were surprised that preserve didn't apply to all strings.

Fixes #9185

Test Plan

cargo test. Reviewed the snapshot changes. Tested the CLI that using quote-style: preserve without the preview flag no longer aborts.

@MichaReiser MichaReiser added cli Related to the command-line interface formatter Related to the formatter labels Feb 10, 2024
Copy link
Contributor

github-actions bot commented Feb 10, 2024

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.

@T-256
Copy link
Contributor

T-256 commented Feb 12, 2024

is this PR is going to merge for next patch release?
it is unknown in versioning policy how config options changes should be applied.

@MichaReiser
Copy link
Member Author

MichaReiser commented Feb 12, 2024

is this PR is going to merge for next patch release? it is unknown in versioning policy how config options changes should be applied.

Yes, this will ship as part of the next patch release. Changing the semantic is is in line with our versioning policy because quote-style: preserve is in preview:

The preview mode is not intended to gate access to work that is incomplete or features that we are likely to remove. However, we reserve the right to make changes to any behavior gated by the mode including the removal of preview features or rules. source

This PR removes the `--preview` requirement for
`quote-style: preserve` and changes the semantics of
the style to apply to all strings (including triple quoted and doc-strings).

The motivation for changing the semantic to apply to all strings is:

* The option is intended as a replacement for black's `--skip-string-normalization` that applies to all strings
* The option is intended for projects that can't enforce a consistent quote style. These are mainly projects that want to use a formatter but can't agree on a single quote style or changing all strings leads to too large diffs. Allowing these users to use a formatter is more important than being opinionated on the quote style
* We received reports that users were surprised that `preserve` didn't apply to all strings.

Fixes #9185
@MichaReiser MichaReiser force-pushed the stabilize-quote-style-preserve branch from 6a79983 to 2689a15 Compare February 12, 2024 09:23
@MichaReiser MichaReiser enabled auto-merge (squash) February 12, 2024 09:30
@MichaReiser MichaReiser merged commit 4946a18 into main Feb 12, 2024
16 checks passed
@MichaReiser MichaReiser deleted the stabilize-quote-style-preserve branch February 12, 2024 09:30
nkxxll pushed a commit to nkxxll/ruff that referenced this pull request Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command-line interface formatter Related to the formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stabilize quote-style: preserve
3 participants