Skip to content

Commit 9ddea77

Browse files
committed
Relax pre-commit update enforcement
No effects were observed on Make-managed files. References: * Cyber-Domain-Ontology/CDO-Shapes-Example#1 Signed-off-by: Alex Nelson <[email protected]>
1 parent 30895c3 commit 9ddea77

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

Makefile

+24-1
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,36 @@ check-supply-chain-mypy: \
7474
--directory tests \
7575
check-mypy
7676

77+
# Update pre-commit configuration and use the updated config file to
78+
# review code. Only have Make exit if 'pre-commit run' modifies files.
7779
check-supply-chain-pre-commit: \
7880
.venv-pre-commit/var/.pre-commit-built.log
7981
source .venv-pre-commit/bin/activate \
8082
&& pre-commit autoupdate
8183
git diff \
8284
--exit-code \
83-
.pre-commit-config.yaml
85+
.pre-commit-config.yaml \
86+
|| ( \
87+
source .venv-pre-commit/bin/activate \
88+
&& pre-commit run \
89+
--all-files \
90+
--config .pre-commit-config.yaml \
91+
) \
92+
|| git diff \
93+
--stat \
94+
--exit-code \
95+
|| ( \
96+
echo \
97+
"WARNING:Makefile:pre-commit configuration can be updated. It appears the updated would change file formatting." \
98+
>&2 \
99+
; exit 1 \
100+
)
101+
@git diff \
102+
--exit-code \
103+
.pre-commit-config.yaml \
104+
|| echo \
105+
"INFO:Makefile:pre-commit configuration can be updated. It appears the update would not change file formatting." \
106+
>&2
84107

85108
clean:
86109
@rm -rf \

0 commit comments

Comments
 (0)