mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 12:55:05 +00:00
Don't reorder parameters in function calls (#7268)
## Summary In `f(*args, a=b, *args2, **kwargs)` the args (`*args`, `*args2`) and keywords (`a=b`, `**kwargs`) are interleaved, which we previously didn't handle. Fixes #6498 **main** | project | similarity index | total files | changed files | |--------------|------------------:|------------------:|------------------:| | cpython | 0.76083 | 1789 | 1632 | | **django** | 0.99966 | 2760 | 58 | | transformers | 0.99930 | 2587 | 447 | | twine | 1.00000 | 33 | 0 | | typeshed | 0.99983 | 3496 | 18 | | warehouse | 0.99825 | 648 | 22 | | zulip | 0.99950 | 1437 | 27 | **PR** | project | similarity index | total files | changed files | |--------------|------------------:|------------------:|------------------:| | cpython | 0.76083 | 1789 | 1632 | | **django** | 0.99967 | 2760 | 53 | | transformers | 0.99930 | 2587 | 447 | | twine | 1.00000 | 33 | 0 | | typeshed | 0.99983 | 3496 | 18 | | warehouse | 0.99825 | 648 | 22 | | zulip | 0.99950 | 1437 | 27 | ## Test Plan New fixtures
This commit is contained in:
parent
56440ad835
commit
f4c7bff36b
6 changed files with 203 additions and 129 deletions
|
@ -575,7 +575,7 @@ pub fn walk_format_spec<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, format_spe
|
|||
pub fn walk_arguments<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, arguments: &'a Arguments) {
|
||||
// Note that the there might be keywords before the last arg, e.g. in
|
||||
// f(*args, a=2, *args2, **kwargs)`, but we follow Python in evaluating first `args` and then
|
||||
// `keywords`. See also [Arguments::arguments_as_declared`].
|
||||
// `keywords`. See also [Arguments::arguments_source_order`].
|
||||
for arg in &arguments.args {
|
||||
visitor.visit_expr(arg);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue