-
Notifications
You must be signed in to change notification settings - Fork 15
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
add pre-commit with ruff #42
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I failed to make it work on my end. I can do $ pre-commit run
manually and that will pickup the errors I made in my test.py
file.
$ pre-commit run
ruff.....................................................................Failed
- hook id: ruff
- exit code: 1
But when I do git add test.py
and git commit -m "commit bad file"
it will happily let me.
$ vim test.py # added the example from here https://realpython.com/ruff-python/#checking-for-errors
$ git add .
$ git commit -m 'test: test pre-commit hook'
[pr/42 59ac220] test: test pre-commit hook
1 file changed, 18 insertions(+)
create mode 100644 test.py
$ git status
On branch pr/42
nothing to commit, working tree clean
🎆 EDIT: I had to re-run $ pre-commit install
and then everything started working as expected. I suggest adding this as an extra install step to the Set-up steps.
c8e0ab8
to
0a21af6
Compare
The changes look good 👍 , just, did you run (Also, it warns about a missing requires-python, adding a |
In this PR description's Set-up section:
This bit seems surprising? uv manages virtual environmeents & dependencies for you, so I'd expect these to be something like "run |
0a21af6
to
27411ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 , no warnings, no diff after sync, works for me :)
[AAP-38768]
Description
This work ensures that each time a developer attempts a commit,
Set-up
uv sync
&uv run ruff / uvx ruff
to manage the uv virtual env and add the dependencies.ruff --version; pytest --version; django-admin --version; pre-commit --version;
uv sync
againTesting
Expected Results
Commit should not complete; it will direct you some output that explains what the pre-commit-with-uv+ruff found.