mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:26:23 +00:00
Fix trailing kwargs end of line comment after slash (#10297)
## Summary Fixes the handling end of line comments that belong to `**kwargs` when the `**kwargs` come after a slash. The issue was that we missed to include the `**kwargs` start position when determining the start of the next node coming after the `/`. Fixes https://github.com/astral-sh/ruff/issues/10281 ## Test Plan Added test
This commit is contained in:
parent
c504d7ab11
commit
965adbed4b
3 changed files with 25 additions and 3 deletions
|
@ -284,6 +284,13 @@ def f42(
|
|||
):
|
||||
pass
|
||||
|
||||
# Regression test for https://github.com/astral-sh/ruff/issues/10281
|
||||
def f43(
|
||||
__bar: str,
|
||||
/,
|
||||
**specifiers: typing.Any, # noqa: ANN401
|
||||
) -> int:
|
||||
return len(specifiers)
|
||||
|
||||
# Check trailing commas are permitted in funcdef argument list.
|
||||
def f(a, ): pass
|
||||
|
@ -760,6 +767,15 @@ def f42(
|
|||
pass
|
||||
|
||||
|
||||
# Regression test for https://github.com/astral-sh/ruff/issues/10281
|
||||
def f43(
|
||||
__bar: str,
|
||||
/,
|
||||
**specifiers: typing.Any, # noqa: ANN401
|
||||
) -> int:
|
||||
return len(specifiers)
|
||||
|
||||
|
||||
# Check trailing commas are permitted in funcdef argument list.
|
||||
def f(
|
||||
a,
|
||||
|
@ -999,6 +1015,3 @@ def function_with_one_argument_and_a_keyword_separator(
|
|||
) -> ReallyReallyReallyReallyReallyReallyReallyReallyLongName:
|
||||
pass
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue