Skip to content

Conversation

@pmeier
Copy link
Contributor

@pmeier pmeier commented Dec 22, 2021

This adds a couple of pre-commit hooks for auto-formatting files in the repository. The include mainly black and usort that are run through ufmt and are fully compatible with Meta internal workflows. In addition, flake8 can also be run through this framework.

To install the hooks pip install pre-commit first and afterwards run pre-commit install inside the repository. Now, every time you git commit something, these hooks will run and make sure the code format is correct. You can also invoke them manually with pre-commit run, which will check all staged files.

For now I only included the configuration files. If they are approved, I'll pull the trigger and push all changes that need to be made to the repository to be compatible with the format.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 22, 2021
@pmeier pmeier requested a review from ejguan December 22, 2021 07:57
@pmeier
Copy link
Contributor Author

pmeier commented Dec 22, 2021

Locally all tests also pass after applying the auto-formatting, so this PR should be good to go as soon as the configs are approved.

Copy link
Contributor

@ejguan ejguan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is amazing. Thank you so much. And, sorry for the late response, I was out of office,

@ejguan
Copy link
Contributor

ejguan commented Jan 3, 2022

LMK after you push all the needed changes, then I will import and land. Thanks a lot.

@pmeier pmeier changed the title Add auto-formatters are pre-commit hooks Add auto-formatters as pre-commit hooks Jan 3, 2022
@pmeier pmeier requested a review from ejguan January 3, 2022 15:52
@facebook-github-bot
Copy link
Contributor

@ejguan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@ejguan ejguan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much. Have a super nit: Can you add several words in CONTRIBUTING.md as the PR summary to help others understand how it works?

@pmeier
Copy link
Contributor Author

pmeier commented Jan 4, 2022

@ejguan See https://github.com/pmeier/data/blob/autoformatters/CONTRIBUTING.md#code-style

@facebook-github-bot
Copy link
Contributor

@ejguan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants