Skip to content

Run ruff and yapf in pre-commit #481

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

cclauss
Copy link
Collaborator

@cclauss cclauss commented Mar 31, 2025

Use https://pre-commit.com to run linting and formatting utilities like ruff and yapf on developer machines as part of the git commit process. Run the same process on GitHub Actions to catch any issues from developers who do not have pre-commit installed locally. This automates linting and formatting before commits are pushed to the repository to eliminate GitHub Actions runs for small issues.

% pre-commit install

pre-commit installed at .git/hooks/pre-commit

% pre-commit autoupdate

[https://github.com/astral-sh/ruff-pre-commit] already up to date!
[https://github.com/google/yapf] already up to date!

% pre-commit run --all-files --verbose

ruff.....................................................................Passed
- hook id: ruff
- duration: 0.06s

All checks passed!

yapf.....................................................................Passed
- hook id: yapf
- duration: 4.22s

Yapf is a bit slow for a pre-commit hook but should still save turnaround time.

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.

1 participant