From c34725486814ee497b3845c5d4b582244738fe6c Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw)" <3293172751nss@gmail.com> Date: Mon, 15 May 2023 14:13:45 +0800 Subject: [PATCH] style: githook design and configuration Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --- script/githooks/pre-commit | 17 +++++++++++++---- script/make-rules/copyright.mk | 1 - script/make-rules/gen.mk | 2 ++ script/make-rules/golang.mk | 2 ++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/script/githooks/pre-commit b/script/githooks/pre-commit index a52d77f5c..26e014346 100644 --- a/script/githooks/pre-commit +++ b/script/githooks/pre-commit @@ -14,6 +14,15 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# ============================================================================== +# This is a pre-commit hook that ensures attempts to commit files that are +# are larger than $limit to your _local_ repo fail, with a helpful error message. + +# You can override the default limit of 2MB by supplying the environment variable: +# GIT_FILE_SIZE_LIMIT=50000000 git commit -m "test: this commit is allowed file sizes up to 50MB" +# +# ============================================================================== + YELLOW="\e[93m" GREEN="\e[32m" @@ -34,9 +43,9 @@ printError() { printMessage "Running local OpenIM pre-commit hook." -#flutter format . -##https://gist.github.com/benmccallum/28e4f216d9d72f5965133e6c43aaff6e -# TODO! GIT_FILE_SIZE_LIMIT=42000000 git commit -m "This commit is allowed file sizes up to 42MB" +# flutter format . +# https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694 +# TODO! GIT_FILE_SIZE_LIMIT=50000000 git commit -m "test: this commit is allowed file sizes up to 50MB" limit=$(( 2 * 2**20 )) # 2MB function file_too_large(){ @@ -46,7 +55,7 @@ function file_too_large(){ cat < TOOLS_DIR -# Questions about go mod instead of go path: https://github.com/kubernetes/kubernetes/issues/117181 ## copyright.verify: Validate boilerplate headers for assign files .PHONY: copyright.verify copyright.verify: tools.verify.addlicense diff --git a/script/make-rules/gen.mk b/script/make-rules/gen.mk index c875223c4..2955d344e 100644 --- a/script/make-rules/gen.mk +++ b/script/make-rules/gen.mk @@ -18,6 +18,8 @@ # ! The stock of code generated by `make gen` should be idempotent # +# Questions about go mod instead of go path: https://github.com/kubernetes/kubernetes/issues/117181 + ## gen.help: show help for gen .PHONY: gen.help diff --git a/script/make-rules/golang.mk b/script/make-rules/golang.mk index 41876ac3c..0ba807342 100644 --- a/script/make-rules/golang.mk +++ b/script/make-rules/golang.mk @@ -16,6 +16,8 @@ # Build management helpers. These functions help to set, save and load the # + + ## copyright.help: Show copyright help .PHONY: go.help go.help: script/make-rules/golang.mk