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

PLR1701: can be automatically fixed #4768

Closed
saippuakauppias opened this issue May 31, 2023 · 3 comments · Fixed by #4792
Closed

PLR1701: can be automatically fixed #4768

saippuakauppias opened this issue May 31, 2023 · 3 comments · Fixed by #4792
Assignees
Labels
fixes Related to suggested fixes for violations

Comments

@saippuakauppias
Copy link

Rule: https://beta.ruff.rs/docs/rules/repeated-isinstance-calls/

The text of the error provides an example to correct it, you can use it to fix it automatically.

It is important to note that if the settings option target-version is set to a version higher than 3.9 - you can use the syntax: isinstance(x, int | float)

@charliermarsh
Copy link
Member

I actually thought we did have autofix for this, but looks like we don't!

(We do have isinstance(x, (int, float)) to isinstance(x, int | float) conversion implemented as part of the UP ruleset.)

@charliermarsh charliermarsh added the fixes Related to suggested fixes for violations label Jun 1, 2023
@dhruvmanila
Copy link
Member

I'll take this one up :)

@Skylion007
Copy link
Contributor

Skylion007 commented Oct 22, 2023

This rule already had an autofix in: https://docs.astral.sh/ruff/rules/duplicate-isinstance-call/, We really need a better way to track aliases/ duplicate rules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixes Related to suggested fixes for violations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants