ruff/crates
konsti a51606a10a
Handle parentheses when formatting slice expressions (#5882)
**Summary** Fix the formatter crash with `x[(1) :: ]` and related code.

**Problem** For assigning comments in slices in subscripts, we need to
find the positions of the colons to assign comments before and after the
colon to the respective lower/upper/step node (or dangling in that
section). Formatting `x[(1) :: ]` was broken because we were looking for
a `:` after the `1` but didn't consider that there could be a `)`
outside the range of the lower node, which contains just the `1` and no
optional parentheses.

**Solution** Use the simple tokenizer directly and skip all closing
parentheses.

**Test Plan** I added regression tests.

Closes #5733
2023-07-19 15:25:25 +00:00
..
flake8_to_ruff Fix nested lists in CONTRIBUTING.md (#5721) 2023-07-13 16:32:59 +00:00
ruff Make lint_only aware of the source kind (#5876) 2023-07-19 09:29:35 +05:30
ruff_benchmark Make lint_only aware of the source kind (#5876) 2023-07-19 09:29:35 +05:30
ruff_cache Only use a single cache file per Python package (#5117) 2023-06-19 17:46:13 +02:00
ruff_cli Make lint_only aware of the source kind (#5876) 2023-07-19 09:29:35 +05:30
ruff_dev Add a tool for shrinking failing examples (#5731) 2023-07-18 08:03:35 +00:00
ruff_diagnostics Run nightly Clippy over the Ruff repo (#5670) 2023-07-10 23:44:38 -04:00
ruff_formatter Add message to formatter SyntaxError (#5881) 2023-07-19 17:15:26 +02:00
ruff_index Add unreachable code rule (#5384) 2023-07-04 14:27:23 +00:00
ruff_macros Run nightly Clippy over the Ruff repo (#5670) 2023-07-10 23:44:38 -04:00
ruff_python_ast Use .as_ref() in lieu of &** (#5874) 2023-07-19 00:49:13 +00:00
ruff_python_formatter Handle parentheses when formatting slice expressions (#5882) 2023-07-19 15:25:25 +00:00
ruff_python_resolver Fix CI by downgrading to cargo insta 1.29.0 (#5589) 2023-07-08 14:54:49 +00:00
ruff_python_semantic Move a few more candidate rules to the deferred Binding-only pass (#5853) 2023-07-19 00:59:02 +00:00
ruff_python_stdlib Use a match statement for builtin detection (#5798) 2023-07-16 04:57:57 +00:00
ruff_python_whitespace perf(formatter): Use memchar for faster back tokenization (#5823) 2023-07-18 21:05:55 +00:00
ruff_rustpython Use consistent Cargo.toml metadata in all crates (#5015) 2023-06-12 00:02:40 +00:00
ruff_shrinking Add a tool for shrinking failing examples (#5731) 2023-07-18 08:03:35 +00:00
ruff_textwrap Use consistent Cargo.toml metadata in all crates (#5015) 2023-06-12 00:02:40 +00:00
ruff_wasm playground: Add AST/Tokens/Formatter panels (#5859) 2023-07-19 14:46:08 +00:00