aiidateam / aiida-core

The official repository for the AiiDA code
https://aiida-core.readthedocs.io
Other
436 stars 191 forks source link

Bump ruff version #6614

Open danielhollas opened 1 week ago

danielhollas commented 1 week ago

Most of the changes here are minor import sorting changes (I checked all of them and they all look more correct than before).

The only other change were couple type-comparison (E721) fixes, these should be reviewed carefully.

I also turned off verbose pytest output in CI since it produces thousands of lines and is very difficult to navigate in Github UI.


type-comparison (E721)

Derived from the pycodestyle linter.

What it does

Checks for object type comparisons using == and other comparison operators.

Why is this bad?

Unlike a direct type comparison, isinstance will also check if an object is an instance of a class or a subclass thereof.

If you want to check for an exact type match, use is or is not.

Known problems

When using libraries that override the == (__eq__) operator (such as NumPy, Pandas, and SQLAlchemy), this rule may produce false positives, as converting from == to is or is not will change the behavior of the code.

For example, the following operations are not equivalent:

import numpy as np

np.array([True, False]) == False
# array([False,  True])

np.array([True, False]) is False
# False

Example

if type(obj) == type(1):
    pass

if type(obj) == int:
    pass

Use instead:

if isinstance(obj, int):
    pass
codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 77.90%. Comparing base (ef60b66) to head (7be553f). Report is 138 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6614 +/- ## ========================================== + Coverage 77.51% 77.90% +0.40% ========================================== Files 560 567 +7 Lines 41444 42147 +703 ========================================== + Hits 32120 32831 +711 + Misses 9324 9316 -8 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features: