internetarchive icon indicating copy to clipboard operation
internetarchive copied to clipboard

Enable black formatting in pre-commit

Open cclauss opened this issue 2 years ago • 2 comments

Add https://github.com/pre-commit/pre-commit-hooks#double-quote-string-fixer because this repo tends to favor single-quotes instead of black-standard double-quotes.

Remove --diff option which prevents black from re-formatting our Python files.

Moveisort configuration into setup.cfg.

Move black configuration out of setup.cfg because black only supports config via pyproject.toml.

pre-commit autoupdate
pre-commit run --all-files

cclauss avatar May 25 '22 17:05 cclauss

It is awesome that we reached this state. I was working on this some months ago when Black reached stable status. Together with sorted imports and so on, minus the type declarations which we have now, but dropped it because it was just such a huge amount of work and getting it all to work together with Poetry was a pain.

I also did not want to do it via pre-commit hooks at the time, but you found a good way to do it with pre-commit hooks.

This should remove virtually all formatting related corrections on new pull requests.

maxz avatar May 25 '22 18:05 maxz

I have never gotten Poetry to sing for me.

cclauss avatar May 25 '22 19:05 cclauss