-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
UP036 should identify sys.version_info[0] or other parts #12993
Comments
I think checking against |
I think Also ruff only runs in Python 3 code. I imagine in a few years people saying: "this thing runs only on python 28 or 29" instead of 3.28 and 3.29 For a litmus test, you can check how often this is used on github repos. There several usages together with [0] and also by itself. https://github.com/search?q=sys.version_info%5B1%5D+language%3Apython&type=code |
I would prefer waiting with |
Cool, thank you! |
I found there was some leftover py2k code in a project that UP rules would not catch because it just matches sys.version_info as a tuple. If you just check for the 1st element, which is kinda common in the old days, it will not show an error.
UP036
It would be helpful if both options were found. I believe this is only relevant for python 2 since python 4 is no longer going to exist, but python 3 will be the forever version with the 2nd number being the de facto python version.
If so, this rule could also catch these cases.
In time: Ruff 0.6.1
The text was updated successfully, but these errors were encountered: