Skip to content

Modernize linting setup and add pre-commit checks in CI#671

Draft
nesnoj wants to merge 9 commits into
developfrom
feature-584-enhance-code-linting
Draft

Modernize linting setup and add pre-commit checks in CI#671
nesnoj wants to merge 9 commits into
developfrom
feature-584-enhance-code-linting

Conversation

@nesnoj

@nesnoj nesnoj commented Oct 21, 2025

Copy link
Copy Markdown
Collaborator

Summary of the discussion

This PR modernizes the linting and code quality setup for the project using ruff. It also establishes automated pre-commit checks in CI (new workflow: .github/workflows/pre-commit.yml) to ensure consistent code quality across all contributions.

  • You can check it by reinstall open-mastr (pip install -e .[dev]) and committing something or run pre-commit run --all-files
  • On commit, the pre-commit hooks should be automatically installed
  • Currently the directories postprocessing/ and open_mastr/soap_api/ are excluded from the tests as they will be removed soon so there's no need to bother about the code quality right now.
  • Important: The linting has NOT been applied to the repo yet! This should be done first as the new CI workflow will fail until all code has been fixed.
  • Includes changes from Limit number of parallel CI jobs #669 so that one should be merged first

Workflow checklist

Automation

Closes #584

PR-Assignee

Reviewer

  • 🐙 Follow the Reviewer Guidelines
  • 🐙 Provided feedback and show sufficient appreciation for the work done

- Consolidate linting with ruff, replaces black and extents linting
- Additional file checks (case-conflict, docstring-first, mixed-line-ending)
- Configure global excludes for build artifacts and cache directories
- Enable ruff docstring checking with numpy convention
Ensures consistent checking locally and on GH
@nesnoj nesnoj self-assigned this Oct 21, 2025
@nesnoj nesnoj added 🚀 feature New feature or request 💥 testing Add, change or delete tests labels Oct 21, 2025
@nesnoj nesnoj marked this pull request as draft October 21, 2025 16:50
@FlorianK13

Copy link
Copy Markdown
Member

I remember that @nesnoj expects a larger diff when linting the whole repo. We used black until now - will there be such a large difference in the codebase between ruff and black linting?

@nesnoj

nesnoj commented Dec 15, 2025

Copy link
Copy Markdown
Collaborator Author

I remember that @nesnoj expects a larger diff when linting the whole repo. We used black until now - will there be such a large difference in the codebase between ruff and black linting?

Yes, definitely! Black only covers some aspects of code quality. Furthermore, in this case ruff is configured quite extensively.
I showcased the changes in #694 .
The most important question is: when do we want to lint the codebase? I propose to do it as last step before the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💥 testing Add, change or delete tests 🚀 feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend linters in precommit hook

2 participants