ruff/crates
Brent Westbrook b5e5271adf
Preserve triple quotes and prefixes for strings (#15818)
## Summary

This is a follow-up to #15726, #15778, and #15794 to preserve the triple
quote and prefix flags in plain strings, bytestrings, and f-strings.

I also added a `StringLiteralFlags::without_triple_quotes` method to
avoid passing along triple quotes in rules like SIM905 where it might
not make sense, as discussed
[here](https://github.com/astral-sh/ruff/pull/15726#discussion_r1930532426).

## Test Plan

Existing tests, plus many new cases in the `generator::tests::quote`
test that should cover all combinations of quotes and prefixes, at least
for simple string bodies.

Closes #7799 when combined with #15694, #15726, #15778, and #15794.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-02-04 08:41:06 -05:00
..
red_knot [red-knot] Support --exit-zero and --error-on-warning (#15746) 2025-02-03 07:35:30 +00:00
red_knot_project [red-knot] Add --ignore, --warn, and --error CLI arguments (#15689) 2025-01-24 16:20:15 +01:00
red_knot_python_semantic Preserve triple quotes and prefixes for strings (#15818) 2025-02-04 08:41:06 -05:00
red_knot_server [red-knot] Make Diagnostic::file optional (#15640) 2025-01-23 10:43:14 +01:00
red_knot_test [red-knot] Hand-written MDTest parser (#15926) 2025-02-04 14:01:53 +01:00
red_knot_vendored Sync vendored typeshed stubs (#15864) 2025-02-01 01:01:58 +00:00
red_knot_wasm Update Rust crate rand to 0.9.0 (#15899) 2025-02-03 12:25:57 +01:00
ruff nit: docs for ignore & select (#15883) 2025-02-04 10:05:41 +01:00
ruff_annotate_snippets Fix docstring in ruff_annotate_snippets (#15748) 2025-01-26 22:25:29 -05:00
ruff_benchmark Vendor benchmark test files (#15878) 2025-02-02 18:16:07 +00:00
ruff_cache
ruff_db [red-knot] ruff_db: make diagnostic rendering prettier (#15856) 2025-01-31 16:37:02 -05:00
ruff_dev Improve Docs: Pylint subcategories' codes (#15909) 2025-02-03 13:53:36 +01:00
ruff_diagnostics
ruff_formatter
ruff_graph Add support for configuring knot in pyproject.toml files (#15493) 2025-01-17 09:41:06 +01:00
ruff_index
ruff_linter Preserve triple quotes and prefixes for strings (#15818) 2025-02-04 08:41:06 -05:00
ruff_macros Flatten red_knot_project import paths (#15616) 2025-01-20 14:57:57 +01:00
ruff_notebook Update Rust crate rand to 0.9.0 (#15899) 2025-02-03 12:25:57 +01:00
ruff_python_ast Preserve triple quotes and prefixes for strings (#15818) 2025-02-04 08:41:06 -05:00
ruff_python_ast_integration_tests
ruff_python_codegen Preserve triple quotes and prefixes for strings (#15818) 2025-02-04 08:41:06 -05:00
ruff_python_formatter Preserve triple quotes and prefixes for strings (#15818) 2025-02-04 08:41:06 -05:00
ruff_python_index
ruff_python_literal Preserve triple quotes and prefixes for strings (#15818) 2025-02-04 08:41:06 -05:00
ruff_python_parser Preserve triple quotes and prefixes for strings (#15818) 2025-02-04 08:41:06 -05:00
ruff_python_resolver
ruff_python_semantic [flake8-pyi] Fix more complex cases (PYI019) (#15821) 2025-02-02 18:38:49 +00:00
ruff_python_stdlib
ruff_python_trivia [red-knot] Hand-written MDTest parser (#15926) 2025-02-04 14:01:53 +01:00
ruff_python_trivia_integration_tests
ruff_server Consider unsafe-fixes settings for code actions (#15666) 2025-01-22 13:44:13 +05:30
ruff_source_file
ruff_text_size [ruff] itertools.starmap(..., zip(...)) (RUF058) (#15483) 2025-01-16 15:18:12 +01:00
ruff_wasm Update Rust crate rand to 0.9.0 (#15899) 2025-02-03 12:25:57 +01:00
ruff_workspace nit: docs for ignore & select (#15883) 2025-02-04 10:05:41 +01:00