ruff/crates
Hoël Bagard 8d73866f70
[`pycodestyle`] Do not trigger `E225` and `E275` when the next token is a ')' (#10315)
## Summary

Fixes #10295.

`E225` (`Missing whitespace around operator`) and `E275` (`Missing
whitespace after keyword`) try to add a white space even when the next
character is a `)` (which is a syntax error in most cases, the
exceptions already being handled). This causes `E202` (`Whitespace
before close bracket`) to try to remove the added whitespace, resulting
in an infinite loop when `E225`/`E275` re-add it.
This PR adds an exception in `E225` and `E275` to not trigger in case
the next token is a `)`. It is a bit simplistic, but it solves the
example given in the issue without introducing a change in behavior
(according to the fixtures).

## Test Plan

`cargo test` and the `ruff-ecosystem` check were used to check that the
PR's changes do not have side-effects.
A new fixture was added to check that running the 3 rules on the example
given in the issue does not cause ruff to fail to converge.
2024-03-11 21:23:18 +00:00
..
ruff `ruff server` - A new built-in LSP for Ruff, written in Rust (#10158) 2024-03-08 20:57:23 -08:00
ruff_benchmark Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_cache Make all dependencies workspace dependencies (#9333) 2024-01-02 13:41:59 +00:00
ruff_dev Make `--config` and `--isolated` global flags (#10150) 2024-03-04 11:19:40 +00:00
ruff_diagnostics Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_formatter `ruff server` - A new built-in LSP for Ruff, written in Rust (#10158) 2024-03-08 20:57:23 -08:00
ruff_index Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_linter [`pycodestyle`] Do not trigger `E225` and `E275` when the next token is a ')' (#10315) 2024-03-11 21:23:18 +00:00
ruff_macros Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_notebook Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_python_ast Start tracking quoting style in the AST (#10298) 2024-03-08 19:11:47 +00:00
ruff_python_codegen Start tracking quoting style in the AST (#10298) 2024-03-08 19:11:47 +00:00
ruff_python_formatter Fix incorrect `Parameter` range for `*args` and `**kwargs` (#10283) 2024-03-08 18:57:49 -05:00
ruff_python_index Track quoting style in the tokenizer (#10256) 2024-03-08 08:40:06 +00:00
ruff_python_literal Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_python_parser Fix incorrect `Parameter` range for `*args` and `**kwargs` (#10283) 2024-03-08 18:57:49 -05:00
ruff_python_resolver Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_python_semantic refactor: Use `QualifiedName` for `Imported::call_path` (#10214) 2024-03-06 09:55:59 +01:00
ruff_python_stdlib Split `CallPath` into `QualifiedName` and `UnqualifiedName` (#10210) 2024-03-04 09:06:51 +00:00
ruff_python_trivia Implement RUF028 to detect useless formatter suppression comments (#9899) 2024-02-28 19:21:06 +00:00
ruff_server `ruff server` - A new built-in LSP for Ruff, written in Rust (#10158) 2024-03-08 20:57:23 -08:00
ruff_shrinking Bump version to v0.3.2 (#10304) 2024-03-09 00:24:22 +00:00
ruff_source_file `ruff server` - A new built-in LSP for Ruff, written in Rust (#10158) 2024-03-08 20:57:23 -08:00
ruff_text_size Range formatting: Fix invalid syntax after parenthesizing expression (#9751) 2024-02-02 17:56:25 +01:00
ruff_wasm Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_workspace Accept a PEP 440 version specifier for required-version (#10216) 2024-03-03 18:43:49 -05:00