Skip to content

Draft: Pre-commit

Johan Forsberg requested to merge pre-commit into main

This adds a pre-commit configuration with flake8 and black, as previously discussed. It should also run in CI.

The changes are pretty large but should only concern autoformatting, plus removal of a couple of unused imports.

I think we also agreed to add isort, and I tried it but unfortunately it conflicts with black about how to format long lines, and I ended up with either tool undoing the changes of the other... so I just ran isort manually and then committed the result. It found a lot, so I think it would be good to have it in pre-commit.

We could probably avoid these problems by using https://docs.astral.sh/ruff/ which basically does all that flake8, black and isort does, in one package (which hopefully does not disagree with itself). If we do want isort I think it would be the simplest way. I put it in draft until we decide on this.

Merge request reports