-
Notifications
You must be signed in to change notification settings - Fork 42
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
[POC] linting with ruff #550
Comments
@adehecq , @duboise-cnes tell me if you agreed |
on the general linting, i agree to put something at the beginning to benefit from the quality wrappers for all code to be done afterwards. I think it is a must have with this too permissive python language. I would nevertheless prefer go to :
See https://docs.astral.sh/ruff/faq/ and ruff is now really mature and faster. So it would be a better choice on linting i would advise "Explain why pylint is in the "test" dependencies in the setup file and see if it's the most appropriate place for it" --> you mean use a "dev" target ? more explicit but if xdem is used with test for dev parts, go for it. No casus belli ;) max line to 120 is a lot for my old me used of little screen but it is the dev standard so ok for me if the code is already there ;) max-module-lines is also important for refactoring goal. 700 or 1000 max could be another issue in parallel of code structure possible refactoring |
Hello, I am glad you suggested using ruff. I will revise the ticket with this solution. |
Ok see internally if it is misconfiguration of ruff and if not enough mature (it's weird nonetheless) I think we keep isort, black, flake8, pylint, mypy as a baseline. |
I didn't know riff, but I think if we could reduce the number of linters to one that manages all, that would certainly make things easier. As for the line length, 79 is really too short when there are 2, 3, 4 indentation levels... 120 is a bit more comfortable. |
Agree on all. |
I finally found a great config file for Ruff, and it seems suitable for our project. I didn’t ignore any rules, so we can discuss them during development if needed. P.S.: We can also choose the line length. |
Context
The goal of this ticket is to implement linting on the code. We have noticed that certain rules applied to demcompare are not applied in the test files of xDEM.
Examples of errors present in the test files:
tests/test_volume.py:252:11: W0125: Using a conditional statement with a constant value (using-constant-test)
tests/test_spatialstats.py:563:12: W0612: Unused variable 'ny' (unused-variable)
tests/test_spatialstats.py:509:0: C0115: Missing class docstring (missing-class-docstring)
tests/test_spatialstats.py:547:4: R0914: Too many local variables (27/15) (too-many-locals)
tests/test_vcrs.py:22:8: C0206: Consider iterating with .items() (consider-using-dict-items)
We cannot guarantee that the same code quality is applied to all the code.
Ruff
We propose using the Ruff linter to reduce the number of tools used in xdem.
Correction
Estimate
3d
The text was updated successfully, but these errors were encountered: