ruff/crates
konsti 56440ad835
Introduce ArgOrKeyword to keep call parameter order (#7302)
## Motivation

The `ast::Arguments` for call argument are split into positional
arguments (args) and keywords arguments (keywords). We currently assume
that call consists of first args and then keywords, which is generally
the case, but not always:

```python
f(*args, a=2, *args2, **kwargs)

class A(*args, a=2, *args2, **kwargs):
    pass
```

The consequence is accidentally reordering arguments
(https://github.com/astral-sh/ruff/pull/7268).

## Summary

`Arguments::args_and_keywords` returns an iterator of an `ArgOrKeyword`
enum that yields args and keywords in the correct order. I've fixed the
obvious `args` and `keywords` usages, but there might be some cases with
wrong assumptions remaining.

## Test Plan

The generator got new test cases, otherwise the stacked PR
(https://github.com/astral-sh/ruff/pull/7268) which uncovered this.
2023-09-13 08:45:46 +00:00
..
flake8_to_ruff Bump version to v0.0.289 (#7308) 2023-09-12 12:00:11 -04:00
ruff Introduce ArgOrKeyword to keep call parameter order (#7302) 2023-09-13 08:45:46 +00:00
ruff_benchmark Enable preview mode during benchmarks (#7208) 2023-09-11 14:09:33 -05:00
ruff_cache Error on zero tab width (#6429) 2023-08-08 16:51:37 -04:00
ruff_cli Bump version to v0.0.289 (#7308) 2023-09-12 12:00:11 -04:00
ruff_dev Update preview and fix documentation symbols (#7207) 2023-09-11 18:08:00 -05:00
ruff_diagnostics Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
ruff_formatter Split implicit concatenated strings before binary expressions (#7145) 2023-09-08 06:51:26 +00:00
ruff_index Add unreachable code rule (#5384) 2023-07-04 14:27:23 +00:00
ruff_macros Update rule selection to respect preview mode (#7195) 2023-09-11 12:28:39 -05:00
ruff_notebook Add NotebookIndex to the cache (#6863) 2023-09-12 18:29:03 +05:30
ruff_python_ast Introduce ArgOrKeyword to keep call parameter order (#7302) 2023-09-13 08:45:46 +00:00
ruff_python_codegen Introduce ArgOrKeyword to keep call parameter order (#7302) 2023-09-13 08:45:46 +00:00
ruff_python_formatter Link discussion in formatter README (#7311) 2023-09-12 16:50:22 +00:00
ruff_python_index Move Ranged into ruff_text_size (#6919) 2023-08-27 14:12:51 -04:00
ruff_python_literal Avoid parsing other parts of a format specification if replacements are present (#6858) 2023-08-25 17:42:57 +00:00
ruff_python_parser Add range to lexer test snapshots (#7265) 2023-09-11 19:12:46 +00:00
ruff_python_resolver Replace .map_or(false, $closure) with .is_some_and(closure) (#6244) 2023-08-01 19:29:42 +02:00
ruff_python_semantic Move refurb/helpers utils to ruff_python_semantic for broader use (#6990) 2023-08-29 14:45:09 -04:00
ruff_python_stdlib Use the unicode-ident crate (#7212) 2023-09-07 08:19:25 +00:00
ruff_python_trivia Use the unicode-ident crate (#7212) 2023-09-07 08:19:25 +00:00
ruff_shrinking Move Ranged into ruff_text_size (#6919) 2023-08-27 14:12:51 -04:00
ruff_source_file Fix D204 when there's a semicolon after a docstring (#7174) 2023-09-11 15:09:47 +02:00
ruff_text_size Unify line size settings between ruff and the formatter (#6873) 2023-08-28 06:44:56 +00:00
ruff_wasm Split implicit concatenated strings before binary expressions (#7145) 2023-09-08 06:51:26 +00:00
ruff_workspace Update rule selection to respect preview mode (#7195) 2023-09-11 12:28:39 -05:00