Repository navigation
Ruff as linter and formatter - #3756
Conversation
|
That took ~3 seconds to run. That's insane! Just for unused imports right now. I think we would exclude init files so we could get fancier. But might be worth thinking about. |
for more information, see https://pre-commit.ci
|
Mayeb it is time to switch no ? |
|
Well if we do switch we need to decide what we want. Currently this is set to lint imports only. But we can fine tune this. We could start by switching this to actually do the black formatting and then add rules if we need to get what we want. We can put this on a meeting agenda! |
|
@zm711 note to self. Turn this into a pre-commit action. Think about which rules we want to start with--probably just black-like formatting. |
|
I think part of these failures are because some of our imports are hard for linters to check. I've made the same mistake where my IDE told me an important was unused only to remove it and push and see our tests fail here. So I think this will be a push-pull. |
|
Ok, I think I'm done with this. The default ruff config only run on I also added a manual pre-commit entry to run ruff on all files (which I did, and fix everything :) ) Added also a section in the docs on how to use it: https://spikeinterface--3756.org.readthedocs.build/en/3756/development/development.html#install-ruff-and-pre-commit This is ready to merge (when all tests pass!) on my end |
|
Looks great, I scrolled through and stopped at anything that looked suspicious (not much). Would like approval from @samuelgarcia before merging! I'll also remind Sam that this PR is Zach's leaving gift! |
I vaguely remember Sam agreeing to switch to ruff. It's rust! So he likes it :) @samuelgarcia ? |
|
Alessio is doing a emotional blackmail on me to force me to approve this PR. |
I just wanted to draft out so we could see. Right now if I did it right--though I doubt it haha. This should just check for unused imports... If we like this we could remove black auto commit and switch with a commit action in the future. But just want to see how this flows.