style: githook design and configuration

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
pull/405/head
Xinwei Xiong(cubxxw) 2 years ago
parent 349439e6d9
commit c347254868

@ -14,6 +14,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # 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" YELLOW="\e[93m"
GREEN="\e[32m" GREEN="\e[32m"
@ -35,8 +44,8 @@ printError() {
printMessage "Running local OpenIM pre-commit hook." printMessage "Running local OpenIM pre-commit hook."
# flutter format . # flutter format .
##https://gist.github.com/benmccallum/28e4f216d9d72f5965133e6c43aaff6e # https://gist.github.com/cubxxw/126b72104ac0b0ca484c9db09c3e5694
# TODO! GIT_FILE_SIZE_LIMIT=42000000 git commit -m "This commit is allowed file sizes up to 42MB" # TODO! GIT_FILE_SIZE_LIMIT=50000000 git commit -m "test: this commit is allowed file sizes up to 50MB"
limit=$(( 2 * 2**20 )) # 2MB limit=$(( 2 * 2**20 )) # 2MB
function file_too_large(){ function file_too_large(){
@ -46,7 +55,7 @@ function file_too_large(){
cat <<HEREDOC cat <<HEREDOC
File $filename is $filesize MB, which is larger than github's maximum File $filename is $filesize MB, which is larger than github's maximum
file size (1 MB). We will not be able to push this file to GitHub. file size (2 MB). We will not be able to push this file to GitHub.
Commit aborted Commit aborted
HEREDOC HEREDOC

@ -20,7 +20,6 @@
LICENSE_TEMPLATE ?= $(ROOT_DIR)/script/LICENSE_TEMPLATES LICENSE_TEMPLATE ?= $(ROOT_DIR)/script/LICENSE_TEMPLATES
# TODO: GOBIN -> TOOLS_DIR # TODO: GOBIN -> 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 ## copyright.verify: Validate boilerplate headers for assign files
.PHONY: copyright.verify .PHONY: copyright.verify
copyright.verify: tools.verify.addlicense copyright.verify: tools.verify.addlicense

@ -18,6 +18,8 @@
# ! The stock of code generated by `make gen` should be idempotent # ! 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 ## gen.help: show help for gen
.PHONY: gen.help .PHONY: gen.help

@ -16,6 +16,8 @@
# Build management helpers. These functions help to set, save and load the # Build management helpers. These functions help to set, save and load the
# #
## copyright.help: Show copyright help ## copyright.help: Show copyright help
.PHONY: go.help .PHONY: go.help
go.help: script/make-rules/golang.mk go.help: script/make-rules/golang.mk

Loading…
Cancel
Save