Parameter
range is incorrect for *args
and **kwargs
#10282
Labels
internal
An internal refactor or improvement
Parameter
range is incorrect for *args
and **kwargs
#10282
I'm working on a fix for the
flake8-unused-arguments
(ARG) rules that would delete them.While working on this, I noticed that the
*args
and**kwargs
Parameter.range
does not include the*
.I think that
Parameter.range
should include*
or**
, leavingParameter.name.range
for the actual name range if needed.See the currently generated AST
ruff/crates/ruff_python_parser/src/snapshots/ruff_python_parser__function__tests__function_pos_and_kw_only_args_with_defaults_and_varargs_and_kwargs.snap
Lines 58 to 67 in 7b4a73d
Here I would expect the
Parameter
range to be 1 longer than theIdentifier
range.ruff/crates/ruff_python_parser/src/snapshots/ruff_python_parser__function__tests__function_pos_and_kw_only_args_with_defaults_and_varargs_and_kwargs.snap
Lines 124 to 134 in 7b4a73d
And here I would expect the
Parameter
range to be 2 longer than theIdentifier
range.If this is indeed considered a bug, I have a PR ready to fix it.
The text was updated successfully, but these errors were encountered: