Skip to content

Enforce code formatting through `pre-commit`

Joakim Saario requested to merge jocke-l/aurweb:styling into master

As discussed on IRC the other day black will be used to format Python source files. In addition to this autoflake will be used to remove unused imports. And as before isort will continue to be used to sort import statements. Since the pre-commit authors have written a bunch of standard hooks for common problems, we'll use some of them too.

Tool configurations are migrated to pyproject.toml with the exception of flake8 since it doesn't support that configuration file (yet). black and isort will try to make the lines no more than 88 characters wide, but given the history of this project this is not always possible, so flake8 will continue to have a max line length of 127 characters for now.

To ensure consistency between CI and contributors, pre-commit will use pinned versions of the formatting tools used.

Note that this MR shouldn't be squashed or rebased. Since that will break the .git-blame-ignore-revs file introduced to reduce git blame noise.

Edited by Joakim Saario

Merge request reports