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

Added scons tool to run black automatically during the build #52765

Closed
wants to merge 1 commit into from

Conversation

dmoody256
Copy link
Contributor

Runs black automatically on the git changeset, and only if the files have changed since the last time it ran.

@dmoody256 dmoody256 requested a review from a team as a code owner September 17, 2021 06:35
@Calinou
Copy link
Member

Calinou commented Sep 17, 2021

We already have a pre-commit hook for black: https://github.com/godotengine/godot/blob/master/misc/hooks/pre-commit-black

Also, in the future, I would prefer switching to a more established tool with #46235. This would make it easier for new contributors to adopt pre-commit hooks 🙂

@dmoody256
Copy link
Contributor Author

We already have a pre-commit hook for black: https://github.com/godotengine/godot/blob/master/misc/hooks/pre-commit-black

How do I make that work automatically?

@Calinou
Copy link
Member

Calinou commented Sep 17, 2021

How do I make that work automatically?

Follow the instructions in the documentation. In short, you need to copy all the files from the repository's misc/hooks to your local .git/hooks/ folder located at the repository root. When you make a commit, the pre-commit hooks will run automatically. Use git commit --no-verify to skip pre-commit hooks if needed.

Switching to pre-commit would make this step easier, since you'd only have to run pip3 install --user pre-commit && pre-commit install at the repository root to get started. Partial commits are also handled automatically by pre-commit.

@dmoody256
Copy link
Contributor Author

How do I make that work automatically?

Follow the instructions in the documentation. In short, you need to copy all the files from the repository's misc/hooks to your local .git/hooks/ folder located at the repository root. When you make a commit, the pre-commit hooks will run automatically. Use git commit --no-verify to skip pre-commit hooks if needed.

Switching to pre-commit would make this step easier, since you'd only have to run pip3 install --user pre-commit && pre-commit install at the repository root to get started. Partial commits are also handled automatically by pre-commit.

The pre-commit hook did not run on my new files in the ninja tool pr #52793, is that intended?

@YuriSizov
Copy link
Contributor

Not sure why a pre-commit hook didn't run for you, but it should, so there is no reason for this enhancement. Drop by the contributors chat if you need help figuring your issue out. Thanks for your contribution nonetheless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants