-
Notifications
You must be signed in to change notification settings - Fork 529
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
Fix pytest call from pre-commit hook, change linter to black #213
Conversation
6b20ba7
to
28b0583
Compare
Is there a reason why you want to switch to Ruff? If all is equivalent I think we want to stick with black for the time being |
lol of course. My bad. I guess it probably should be black to be consistent with the open-interpreter repo, what do you think? |
Agreed, I have no preference but consistency. I will move the PR to Draft and update it to black today or this weekend. Thanks for your time @tyfiero! |
5f98d55
to
130c0ac
Compare
@tyfiero updateded linter from |
Done deal! Thanks again |
Closes #210.
Problem
The
pytest
step in the pre-commit hook only works when ran from the software directory. Meaning if you commit from anywhere else (e.g. root directory) it will fail, preventing you from committing. This incentivizes using--no-verify
to push code to a PR, bypassing code checks for quality when the pre-commit hook is actually installed.Also, contribution guidelines weren't up-to-date regarding the pre-commit hook. They also failed to mention the subtle issue of environment specific pre-commit install, which may lead to confusing state when running
pytest
if it is not installed globally.Solution
How to test
01/software
directorypoetry shell
cd ..
)pre-commit run pytest --all-files
Alternatively for step 4, create a file (
touch foo
) and commit it (git add foo && git commit -m "foo"
).Then
git reset HEAD~1
to cancel the commit andrm foo
to remove the file.Tested on
Discussion
A specific tweak is necessary for Windows (version 10 at least) PowerShell, otherwise the pytest step will stale and fail silently (pre-commit in verbose mode allowed to catch the issue.
Another notable change stemming from the PR conversation is the confusion over the linter (was announced as
black
in the contribution docs, butruff
was installed instead). For consistency withinterpreter
, it was changed toblack
.