Skip to content
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

Significant pre-commit/CI improvements #1495

Merged
merged 1 commit into from
Nov 6, 2024
Merged

Conversation

dokterbob
Copy link
Collaborator

@dokterbob dokterbob commented Oct 31, 2024

To "End The Suffering" of "Endless Spinning Pizza" as punishment for merely rolling a commit, hereby the following proposed improvements to pre-commit hooks and CI:

  1. Replace isort and black with ruff (x20 performance!) in pre-commit hook.
  2. Add ruff as linter in pre-commit hook.
  3. Use dmypy (mypy deamon) for much faster repeated Python linting.
  4. Only call Python linter when actual Python files changed (using `lint-staged).
  5. Enable ruff linting and formatting checks in CI.
  6. Enable linting for GitHub Actions (requires additional install of https://github.com/rhysd/actionlint).
  7. Bump husky and mypy to latest versions.

After this ticket, towards the future, I would like to propose:

  • Switching to pyright for more thorough linting (as it stands, it finds too many actual errors to be even usable).
  • Consider switching to pre-commit from husky, which automates installing linters.
  • Only call various GH workflows when relevant components have changed (e.g. no need to lint Python files when only JS files have changed and vice versa).

@dokterbob dokterbob changed the title Dokterbob/ruff it up Significant pre-commit/CI improvements Oct 31, 2024
@dokterbob dokterbob force-pushed the dokterbob/ruff-it-up branch 2 times, most recently from 0e60dd4 to 5089d13 Compare October 31, 2024 14:42
@dokterbob dokterbob marked this pull request as ready for review October 31, 2024 15:41
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. dev-tooling Relating to developer/contributor toolings. labels Oct 31, 2024
@dokterbob dokterbob added the review-me Ready for review! label Oct 31, 2024
* Small improvements to build script.
* Use ruff for linting and formatting.
* Use mypy daemon for (much) faster type-checking.
* Add typing to `cache.py` to fix it's requirements.
* Bump to latest mypy for increased performance.
* Bump husky to latest version.
* Only lint Python when Python files have changed.
* Linting for GitHub Actions.
  Requires actionlint: https://github.com/rhysd/actionlint
* Linting and formatting check in CI.
@dokterbob dokterbob merged commit fcf51c7 into main Nov 6, 2024
9 checks passed
@dokterbob dokterbob deleted the dokterbob/ruff-it-up branch November 6, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-tooling Relating to developer/contributor toolings. review-me Ready for review! size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants