ruff/crates
Charlie Marsh f401050878
Introduce PythonWhitespace to confine trim operations to Python whitespace (#4994)
## Summary

We use `.trim()` and friends in a bunch of places, to strip whitespace
from source code. However, not all Unicode whitespace characters are
considered "whitespace" in Python, which only supports the standard
space, tab, and form-feed characters.

This PR audits our usages of `.trim()`, `.trim_start()`, `.trim_end()`,
and `char::is_whitespace`, and replaces them as appropriate with a new
`.trim_whitespace()` analogues, powered by a `PythonWhitespace` trait.

In general, the only place that should continue to use `.trim()` is
content within docstrings, which don't need to adhere to Python's
semantic definitions of whitespace.

Closes #4991.
2023-06-09 21:44:50 -04:00
..
flake8_to_ruff Update links to point to Astral org (#4949) 2023-06-08 11:43:40 -04:00
ruff Introduce PythonWhitespace to confine trim operations to Python whitespace (#4994) 2023-06-09 21:44:50 -04:00
ruff_benchmark Add Formatter benchmark (#4860) 2023-06-05 21:05:42 +02:00
ruff_cache
ruff_cli Update links to point to Astral org (#4949) 2023-06-08 11:43:40 -04:00
ruff_dev
ruff_diagnostics Use a separate fix-isolation group for every parent node (#4774) 2023-06-02 03:07:55 +00:00
ruff_formatter Rename ruff_formatter::builders::BestFitting to FormatBestFitting (#4841) 2023-06-04 00:13:51 +02:00
ruff_index
ruff_macros Update links to point to Astral org (#4949) 2023-06-08 11:43:40 -04:00
ruff_python_ast Introduce PythonWhitespace to confine trim operations to Python whitespace (#4994) 2023-06-09 21:44:50 -04:00
ruff_python_formatter Introduce PythonWhitespace to confine trim operations to Python whitespace (#4994) 2023-06-09 21:44:50 -04:00
ruff_python_semantic Rename some methods on SemanticModel (#4990) 2023-06-09 19:36:59 +00:00
ruff_python_stdlib
ruff_python_whitespace Introduce PythonWhitespace to confine trim operations to Python whitespace (#4994) 2023-06-09 21:44:50 -04:00
ruff_rustpython
ruff_testing_macros
ruff_textwrap Move Python whitespace utilities into new ruff_python_whitespace crate (#4993) 2023-06-10 00:59:57 +00:00
ruff_wasm