-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
[PSA for PR authors] Update your pre-commit hooks to use the newly merged pre-commit
framework
#88901
Comments
We should also update the godot docs, as they point to the old way: https://docs.godotengine.org/en/latest/contributing/development/code_style_guidelines.html#pre-commit-hook and https://docs.godotengine.org/en/latest/contributing/development/code_style_guidelines.html#id3; when opening a PR it also points to one of these URLs |
Might be either something wrong with your specific file, if you added one you might have accidentally added an encoding to it, check your editor, otherwise this is likely a configuration error in your terminal, are you running from powershell or cmd? |
I did not touch these files at all. I am running from powershell, I think it's reading the files in the standard platform encoding (which is cp1252 on windows if I recall):
|
Assuming you're working on #89826, can you check that the new file you added is encoded in utf8? Just to double check that isn't throwing it off somehow
This is probably just missing from here: godot/misc/scripts/copyright_headers.py Line 72 in 99ff024
Try changing it to include the encoding directive and see |
Could be that you changing that file broke some encoding in it so it has that error now, unsure, try resetting all the rest of the files and run it again so it hasn't accidentally broken those files when you ran it before I tried fixing the encoding part and it works fine for me, though it also didn't break things when I ran it without that addition Edit: Installed the pre-commit hooks properly now and it works fine with or without these changes |
I can confirm now that adding So I guess its save to say that |
Now ran into this myself, unsure why it didn't happen before, will look at a fix while I'm working on other code |
Adding here for potential future reference (maybe worth adding a note in the documentation?): When using msys2 on Windows, directly installing The workaround I've found is installing
|
We just replaced our hand-written shell scripts for pre-commit hooks with a set of hooks defined using the
pre-commit
Python framework:pre-commit
Python tool #88866Previous hooks should still work if you copied the scripts manually from
misc/hooks/
, but if you used to symlink them, they will be broken as of #88866 so you should remove them from.git/hooks/
.To use the new system, remove old hooks from
.git/hooks/
, and apply the new hooks with:That's all, it should then automatically download dependencies (currently
clang-format
andblack
) the first time you try to commit, or when runningpre-commit run
manually.If you want to apply the hooks to all your local changes before committing, you can use
pre-commit run
. You can also apply the hooks to all files in the repository regardless of their changed status by adding the-a
option (pre-commit run -a
).The main workflow difference with the previous set of hooks is that if some changes are needed to pass the checks, they will be made automatically in place (at least for clang-format and black currently). Let's see if that workflow is fine, or if we need to figure out ways to bring back some interactivity.
The text was updated successfully, but these errors were encountered: