Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pylint] Fix convert a code keyword argument to a positional argument (PLR1722) #16424

Merged
merged 8 commits into from
Mar 3, 2025

Conversation

VascoSch92
Copy link
Contributor

The PR addresses issue #16396 .

Specifically:

  • If the exit statement contains a code keyword argument, it is converted into a positional argument.
  • If retrieving the code from the exit statement is not possible, a violation is raised without suggesting a fix.

Copy link
Contributor

github-actions bot commented Feb 27, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre added the bug Something isn't working label Feb 27, 2025
@ntBre ntBre linked an issue Feb 27, 2025 that may be closed by this pull request
@MichaReiser MichaReiser requested a review from ntBre February 28, 2025 08:11
Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think we can simplify the implementation a bit here and also support more use cases at the same time.

@VascoSch92
Copy link
Contributor Author

Hey @ntBre

thank you very much for the feedback. Yes, my solution was pretty convoluted. I suspected there it was a better way to do it but I could not find how ;-)

Everything works fine.

I also added the test cases that you suggested and it seems that the output it is what expected.

@VascoSch92 VascoSch92 requested a review from ntBre March 1, 2025 12:44
@VascoSch92 VascoSch92 requested a review from ntBre March 2, 2025 18:58
Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thank you!

@ntBre ntBre merged commit 4d92e20 into astral-sh:main Mar 3, 2025
21 checks passed
@VascoSch92 VascoSch92 deleted the PLR1722 branch March 3, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PLR1722 should convert a code keyword argument to a positional argument
2 participants