Skip to content

[Lint] Use ruff formatter and pre-commit framework#2748

Open
tovaz92 wants to merge 11 commits intomainfrom
pre-commit-black-lint
Open

[Lint] Use ruff formatter and pre-commit framework#2748
tovaz92 wants to merge 11 commits intomainfrom
pre-commit-black-lint

Conversation

@tovaz92
Copy link
Collaborator

@tovaz92 tovaz92 commented Mar 6, 2026

This PR aim to:

  1. substitute flake8 linter with ruff linter-formatter
  2. integrate pre-commit
  3. add GitHub action that check the pushed files at every commit

Note once pre-commit is installed:

  • pre-commit-hooks will run: trailing-whitespace, end-of-file-fixer, check-yaml and will run on all committed files
  • ruff-pre-commit will run: ruff-check, ruff-format (only on .py files).

Installation:
Follow steps below to make pre-commit operative:

  1. To install pre-commit: pip install -e ".[precommit]" (otherwise if the user want to install aqua with environment.yml, uncomment the relative line)
  2. To "switch-on" pre-commit, install it with: pre-commit install
  3. Once installed, at every commit, pre-commit will run on the pushed files and will block the commit if the checks do not pass.
  4. If the user want to uninstall pre-commit definitively run: pre-commit uninstall or, if want to temporarily "switch-off" (need to be reinstalled after the unchecked push):

Issues closed by this pull request:

Close #2738

  • Documentation is included if a new feature is included.
  • Changelog is updated.
  • environment.yml and pyproject.toml are updated if needed, together with the lumi installation tool. Installation instructions are updated if new conda dependencies are added.

@tovaz92 tovaz92 self-assigned this Mar 6, 2026
tovaz92 added a commit to DestinE-Climate-DT/AQUA-diagnostics that referenced this pull request Mar 6, 2026
@tovaz92
Copy link
Collaborator Author

tovaz92 commented Mar 11, 2026

After a chat with the group, we will go for Ruff as it is much more flexible for our needs.

@tovaz92 tovaz92 changed the title [Lint] Use black formatter and pre-commit framework [Lint] Use ruff formatter and pre-commit framework Mar 11, 2026
@tovaz92
Copy link
Collaborator Author

tovaz92 commented Mar 13, 2026

ok, the action seems to behave as we expected. It is failing and showing all the problems. I am tempted to exclude the __init__.py files though.

@tovaz92
Copy link
Collaborator Author

tovaz92 commented Mar 14, 2026

Just tested pre-commit locally following the steps in this PR description/intallation

@tovaz92 tovaz92 mentioned this pull request Mar 17, 2026
1 task
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.

The big linting

2 participants