-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
Add ruff linter to pre-commit #5275
Add ruff linter to pre-commit #5275
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5275 +/- ##
==========================================
+ Coverage 89.10% 89.16% +0.06%
==========================================
Files 584 584
Lines 49503 49534 +31
==========================================
+ Hits 44110 44168 +58
+ Misses 5393 5366 -27
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
Only one comment about ImportError -> ModuleNotFoundError.
The bare except is was even worse, even ImportError is an improvement.
4925ef2
to
5d7eb37
Compare
I'm not convinced about the examples changes... Examples are supposed to be a quick way to get introduced to stuff, and I find it very distracting to see all those gibberish comments. I know what they mean, but anyone sho doesn't maintain a project probably would just be confused. I'd say either we fix the examples so they obey the rules, or we skip examples. |
@Carreau You request changes, and it is blocking this PR. I think that I have addressed your worries but maybe not all?
But if you open this code in any Python IDE same lines without these comments will be highlighted as errors. |
@brisvag I have workaround |
@@ -24,8 +24,8 @@ | |||
# important: if this is not set, the entire ~4GB array will be created! | |||
os.environ.setdefault('NAPARI_OCTREE', '1') |
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.
does this have to be before import of napari? Otherwise, we can move it below to avoid the import lint errors.
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.
Yes. It needs to be before. Currently, the octree is resolved on startup.
It is the weak point of napari but out of this PR scope.
Feel free to dismiss reviews – or al least you should be able to dismiss them. I was not requesting changes as a way to block, but just suggestions. |
How I could do this? |
Oh no, what have I done! I created a monster 😨 |
Description
Add ruff linter to pre-commit. Ruff is Rust written linter for python as a much faster replacement for flake8. Currently is not ready for total replacement, but maybe a nice addition as do not impact significantly on the pre-commit time run.
Also, this PR contains multiple fixes in napari files. Mostly add missed
__all__
in__init__.py
files.Type of change
References
How has this been tested?
as there are small differences between the two Qt bindings.
Final checklist:
trans.
to make them localizable.For more information see our translations guide.