mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 13:34:40 +00:00
![]() ## 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. |
||
---|---|---|
.. | ||
flake8_to_ruff | ||
ruff | ||
ruff_benchmark | ||
ruff_cache | ||
ruff_cli | ||
ruff_dev | ||
ruff_diagnostics | ||
ruff_formatter | ||
ruff_index | ||
ruff_macros | ||
ruff_python_ast | ||
ruff_python_formatter | ||
ruff_python_semantic | ||
ruff_python_stdlib | ||
ruff_python_whitespace | ||
ruff_rustpython | ||
ruff_testing_macros | ||
ruff_textwrap | ||
ruff_wasm |