Skip to content

Use ruff for formatting and document code quality #729

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 8 commits into from
Dec 13, 2024
Merged

Conversation

olethanh
Copy link
Collaborator

Switch to ruff for formatting (not linting) instead of black.

Self proofreading checklist

  • The new code clear, easy to read and well commented.
  • New code does not duplicate the functions of builtin or popular libraries.
  • An LLM was used to review the new code and look for simplifications.
  • New classes and functions contain docstrings explaining what they provide.
  • All new code is covered by relevant tests.
  • Documentation has been updated regarding these changes.
  • Dependencies update in the project.toml have been mirrored in the Debian package build script packaging/Makefile

Changes

To clarify, ruff has two mode:

  • formatting, launched with ruff format or hatch fmt --formatter, which is more or less equivalent to black
  • linting, lauched with ruff --fix or ruff check fix or hatch fmt --linter, which check the code style more comprehensively and which fixes can't always be automated.

The builtin command hatch fmt launch both. But in aleph-vm we use hatch linting:fmt (or linting:style ) that do a whole bunch additional checks (yaml, pyproject.toml, etc..)

This PR remove black execution from the fmt/style scripts in hatch but keep it configured and installed for now (so we can double check and to ease transition)

The ruff configuration is also modified so it match what isort do. We still use isort as ruff format doesn't match that capability (but ruff lint does)

Did a ruff check on tests (lint)

How to test

No expected behaviural chnage in the program run.

Notes

@olethanh olethanh requested review from Psycojoker and hoh December 12, 2024 15:34
Copy link

codecov bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.49%. Comparing base (0241c04) to head (1d4fc69).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #729      +/-   ##
==========================================
- Coverage   62.50%   62.49%   -0.01%     
==========================================
  Files          70       70              
  Lines        6232     6231       -1     
  Branches      506      506              
==========================================
- Hits         3895     3894       -1     
  Misses       2179     2179              
  Partials      158      158              

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

Copy link
Collaborator

@Psycojoker Psycojoker left a comment

Choose a reason for hiding this comment

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

LGTM

@olethanh olethanh merged commit db356af into main Dec 13, 2024
22 checks passed
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.

3 participants