This pull request proposes using pre-commit with ~25 lines of configuration to rapidly run these two tools locally on contributors' machines and also in our GitHub Actions to cover any contributors who do not have pre-commit installed.
The 15 exclude lines should be removed gradually as more of the codebase passes the formatting and linting process.
How to use:
brew install pre-commit # or `python3 -m pip install pre-commit`
pre-commit install
> pre-commit installed at .git/hooks/pre-commit
pre-commit autoupdate
> [https://github.com/psf/black-pre-commit-mirror] already up to date!
> [https://github.com/pre-commit/mirrors-clang-format] already up to date!
pre-commit run --all-files
> black....................................................................Passed
> clang-format.............................................................Passed
Running
python3 setup.py lint
is deprecated. https://packaging.python.org/en/latest/discussions/setup-py-deprecatedThe
setup.py
logic for runningblack
andclang-format
is ~100 lines long and is skipping many Python and C files. https://github.com/pygame-community/pygame-ce/blob/65a256d9464ae22141ac9622ca35c558d293509f/setup.py#L786-L875This pull request proposes using
pre-commit
with ~25 lines of configuration to rapidly run these two tools locally on contributors' machines and also in our GitHub Actions to cover any contributors who do not havepre-commit
installed.The 15
exclude
lines should be removed gradually as more of the codebase passes the formatting and linting process.How to use: