Skip to content

Fix trailing kwargs end of line comment after slash#10297

Merged
MichaReiser merged 2 commits intomainfrom
fix-trailing-kwargs-comment-after-slash
Mar 8, 2024
Merged

Fix trailing kwargs end of line comment after slash#10297
MichaReiser merged 2 commits intomainfrom
fix-trailing-kwargs-comment-after-slash

Conversation

@MichaReiser
Copy link
Member

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 #10281

Test Plan

Added test

@MichaReiser MichaReiser added bug Something isn't working formatter Related to the formatter labels Mar 8, 2024
@MichaReiser MichaReiser requested a review from konstin March 8, 2024 13:04
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2024

ruff-ecosystem results

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@MichaReiser MichaReiser force-pushed the fix-trailing-kwargs-comment-after-slash branch from 2a1c883 to ebb2177 Compare March 8, 2024 14:38
@MichaReiser MichaReiser enabled auto-merge (squash) March 8, 2024 14:38
@MichaReiser MichaReiser merged commit 965adbe into main Mar 8, 2024
@MichaReiser MichaReiser deleted the fix-trailing-kwargs-comment-after-slash branch March 8, 2024 14:45
nkxxll pushed a commit to nkxxll/ruff that referenced this pull request Mar 10, 2024
## 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 astral-sh#10281

## Test Plan

Added test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working formatter Related to the formatter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ruff format moves # noqa comment to wrong location

2 participants