-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
enable ruff rule to check for unused imports #9182
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been testing this one locally, and on the one hand it appears to be working, but on the other hand is scares me a lot because of the way some of these imports give the appearance of being unused.
I am putting this on testing to see how it goes. Thanks for all your work on this so far, @RayBB. I definitely want to see this merged.
@scottbarnes I agree it is a bit tricky to feel confident in this. I tried to be a bit conservative in keeping many that were kinda odd but would be good to review with someone who knows these imports better. |
It's probably OK to remove unused imports for standard library modules, but anything in the openlibrary/infogami/web.py sphere I'd be exceedingly careful of. The have been multiple attempts to do this and people always end up putting them back when they discover hidden side effect dependencies. |
Seems like it's in a good state, but we may not know what we don't know, so let's talk once more during 1:1 on Wed @scottbarnes and make sure we're happy with the approach (or whether we want to roll this out in stages) |
I've done a review, my hesitation would be that there could be prod instances (like crons on other tasks that require these imports in other contexts) however, I think TIAS (try it and see) seems like a reasonable approach given having reviewed the specific contexts of these changes and my perceived risks of them. Especially since it's marked as
Needs: Special Deploy
|
@scottbarnes ready to go, my apologies though if you're willing to tweak this pr against the follow changes, we should be good to merge. |
aa29920
to
b951159
Compare
@mekarpeles @scottbarnes excellent. I think this will be a big win for keeping the code clean. Fingers crossed to not hit any snags with the deploy |
Closes #9181
Technical
Testing
The tests are passing, and things work fine locally. But we should be thoughtful about if any of these removed imports have side effects we need.
Screenshot
Stakeholders