Closed curita closed 1 year ago
@kmike Suggested using pre-commit instead Example from Scrapy: https://github.com/scrapy/scrapy/blob/master/.pre-commit-config.yaml
pre-commit is a good improvement into the project. I am using in all my current projects.
We can add a pre-commit run --all
call in the build, so it will fail if the formatting (and other tests) fail, avoiding us to commit code that doesn't match.
Probably it will require one big commit to format the entire project once.
The project is already formatted with Black, and only a few files needs to be reformatted with the new rules of black 23.1.0 so introducing this won't cause a huge diff.
Issue
Newly opened PRs are failing in their Python 3.10 build (reference).
Cause
This looks to be caused by the
black
check, which in its latest version introduced some new rules (removing new lines after class and function declarations, adding trailing commas to the last elements of iterables, etc.).Proposal
To avoid these errors from happening, we could run the latest version of
black
over the whole codebase and/or pin its version.