From 45824e6a8656b4bbf6d25a2a6b7576603a71e651 Mon Sep 17 00:00:00 2001 From: Alex Nelson Date: Wed, 22 May 2024 08:52:58 -0400 Subject: [PATCH] Relax pre-commit update enforcement No effects were observed on Make-managed files. References: * https://github.com/Cyber-Domain-Ontology/CDO-Shapes-Example/pull/1 Signed-off-by: Alex Nelson --- Makefile | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ca1c8f9..eb5d818 100644 --- a/Makefile +++ b/Makefile @@ -82,13 +82,37 @@ check-supply-chain: \ check-supply-chain-pre-commit # This target is scheduled to run as part of prerelease review. +# +# Update pre-commit configuration and use the updated config file to +# review code. Only have Make exit if 'pre-commit run' modifies files. check-supply-chain-pre-commit: \ .venv-pre-commit/var/.pre-commit-built.log source .venv-pre-commit/bin/activate \ && pre-commit autoupdate git diff \ --exit-code \ - .pre-commit-config.yaml + .pre-commit-config.yaml \ + || ( \ + source .venv-pre-commit/bin/activate \ + && pre-commit run \ + --all-files \ + --config .pre-commit-config.yaml \ + ) \ + || git diff \ + --stat \ + --exit-code \ + || ( \ + echo \ + "WARNING:Makefile:pre-commit configuration can be updated. It appears the updated would change file formatting." \ + >&2 \ + ; exit 1 \ + ) + @git diff \ + --exit-code \ + .pre-commit-config.yaml \ + || echo \ + "INFO:Makefile:pre-commit configuration can be updated. It appears the update would not change file formatting." \ + >&2 clean: \ clean-figures \