From 5c4a370b70e30135bc2eaa666b0f3b78011db055 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver <thomas@kluyver.me.uk> Date: Wed, 23 Jun 2021 13:13:14 +0100 Subject: [PATCH] Restore flake8 check with ... diff --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5a96f943e..400c9486b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,14 @@ repos: rev: 5.7.0 hooks: - id: isort + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.9.0 + hooks: + - id: flake8 + # If `CI_MERGE_REQUEST_TARGET_BRANCH_SHA` env var is set then this will + # run flake8 on the diff of the merge request, otherwise it will run + # flake8 as it would usually execute via the pre-commit hook + entry: bash -c 'if [ -z ${CI_MERGE_REQUEST_TARGET_BRANCH_SHA} ]; then (flake8 "$@"); else (git diff $CI_MERGE_REQUEST_TARGET_BRANCH_SHA...$CI_MERGE_REQUEST_SOURCE_BRANCH_SHA | flake8 --diff); fi' -- - repo: https://github.com/myint/rstcheck rev: 3f92957478422df87bd730abde66f089cc1ee19b # commit where pre-commit support was added hooks: -- GitLab