Skip to content

Run pre-commit in CI

Benjamin Bertrand requested to merge run-pre-commit-in-ci into develop

pre-commit is already used in the project. Let's use it in CI as well.

Avoid having to maintain the versions of black and flake8 in 2 different places.

  • I added max-line-length = 88 to flake8 config as recommended by black documentation.
  • I removed language_version from pre-commit config. I think forcing to use a specific version just makes it more difficult to run pre-commit. What matters for black is the target-version.
  • Removed target-version from pre-commit config. It's already defined in pyproject.toml.

I moved the pre-commit job to a check stage that is run before anything. I think it makes sense to have the pipeline fail as early as possible to force people using pre-commit locally. But we could leave it in the test stage if you prefer.

Merge request reports