Skip to content

Use Ruff instead of flake8 #1789

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

Merged
merged 7 commits into from
Apr 24, 2025
Merged

Use Ruff instead of flake8 #1789

merged 7 commits into from
Apr 24, 2025

Conversation

pjonsson
Copy link
Contributor

@pjonsson pjonsson commented Apr 17, 2025

Reason for this pull request

Ruff is a fast linter that can check the rules of flake8 and a number of flake8 plugins. Ruff is made by the same people that make uv, and my experience from making a few functional bug reports on Ruff in Q2 2024 is that the bugs were fixed within hours/days, and a new release of Ruff was available within a week.

The main advantage beyond the speed is that after this PR, uv sync provides everything for development, so it's easy to uv run ruff check --fix locally during development.

There are Ruff lint failures on the current develop branch, so this PR consists of a number of individual commits that fixes these problems in the code and gives a reasonable commit message for each one of them so git blame can be followed, and then a commit that adds Ruff to pyproject.toml, switches from flake8 to Ruff in the pre-commit config, and adds a couple of suppressions in the source code.

Besides the code fixes, this PR mirrors opendatacube/datacube-explorer#587 except no formatting checks are enabled.

Proposed changes

  • Closes #xxxx

  • Tests added / passed

  • Fully documented, including docs/about/whats_new.rst for all changes


📚 Documentation preview 📚: https://datacube-core--1789.org.readthedocs.build/en/1789/

@pjonsson pjonsson force-pushed the use-ruff branch 2 times, most recently from 2f20952 to febd220 Compare April 17, 2025 17:13
# 4326, crossing the Prime-Meridian, wound counter-clockwise
am_4326_cw = polygon((
am_4326_cw = polygon(( # noqa: F841
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This polygon is unused and it didn't work to copy the assert for the corresponding pm equivalence for this, so disabling the check for now. Will make an issue so someone who knows about these things can take a look at it later.

Copy link

codecov bot commented Apr 17, 2025

Codecov Report

Attention: Patch coverage is 63.63636% with 4 lines in your changes missing coverage. Please review.

Project coverage is 85.78%. Comparing base (9702d15) to head (acbd251).
Report is 513 commits behind head on develop.

Files with missing lines Patch % Lines
datacube/utils/geometry/_base.py 0.00% 2 Missing ⚠️
datacube/index/abstract/_products.py 0.00% 1 Missing ⚠️
datacube/storage/_rio.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1789      +/-   ##
===========================================
+ Coverage    85.76%   85.78%   +0.01%     
===========================================
  Files          149      149              
  Lines        16186    16180       -6     
===========================================
- Hits         13882    13880       -2     
+ Misses        2304     2300       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Remove some leftovers that should have
been in commit 7a8203b.
This stopped being passed as parameter
in commit 9db718f in 2019.
This is a cut and paste of the test that was
originally placed above the current test
in commit 485b14b.
Copy link
Member

@omad omad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good to me, thanks.

@omad omad merged commit a3aacc3 into opendatacube:develop Apr 24, 2025
19 checks passed
@pjonsson pjonsson deleted the use-ruff branch April 24, 2025 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants