From a20047779e302a4d7457f89abf6500eb02b208b1 Mon Sep 17 00:00:00 2001 From: Sebastiaan ten Pas <st981@cam.ac.uk> Date: Thu, 20 Mar 2025 16:09:39 +0000 Subject: [PATCH] chore: backport pre-commit changes from ap-backend --- CHANGELOG | 6 ++++++ template/.gitlab/webapp.gitlab-ci.yml | 2 +- template/.pre-commit-config.yaml | 23 +++++++++++++++++------ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e888139..e2222df 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.3] - 2025-03-20 + +### Changed + +- Update pre-commit hooks + ## [1.0.2] - 2024-09-18 ### Added diff --git a/template/.gitlab/webapp.gitlab-ci.yml b/template/.gitlab/webapp.gitlab-ci.yml index b5db8df..b7fcaab 100644 --- a/template/.gitlab/webapp.gitlab-ci.yml +++ b/template/.gitlab/webapp.gitlab-ci.yml @@ -22,7 +22,7 @@ python:tox: matrix: - PYTHON_VERSION: "3.11" # Make sure this matches the version in pyproject.toml and the Dockerfile. variables: - TOX_ADDITIONAL_REQUIREMENTS: "poetry>=1.7.1" + TOX_ADDITIONAL_REQUIREMENTS: "poetry>=1.8.2" rules: - !reference [build, rules] diff --git a/template/.pre-commit-config.yaml b/template/.pre-commit-config.yaml index 8c5a305..18d1071 100644 --- a/template/.pre-commit-config.yaml +++ b/template/.pre-commit-config.yaml @@ -1,10 +1,13 @@ -# See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer + # TODO: Remove this once + # https://gitlab.developers.cam.ac.uk/uis/devops/continuous-delivery/ci-templates/-/issues/57 + # is addressed. + exclude: ^(CHANGELOG\.md|\.copier-answers\.yml)$ - id: check-yaml args: - --unsafe @@ -24,17 +27,17 @@ repos: - id: debug-statements - repo: https://github.com/python-poetry/poetry - rev: 1.5.1 + rev: 1.8.2 hooks: - id: poetry-check - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 25.1.0 hooks: - id: black - - repo: https://github.com/timothycrosley/isort - rev: 5.12.0 + - repo: https://github.com/PyCQA/isort + rev: 6.0.0 hooks: - id: isort @@ -44,6 +47,14 @@ repos: - id: flake8 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.4.1 + rev: v1.15.0 hooks: - id: mypy + + - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook + rev: v9.21.0 + hooks: + - id: commitlint + stages: [commit-msg] + additional_dependencies: ['@commitlint/config-conventional'] + args: ['--config', '.commitlintrc.json'] -- GitLab