2020-10-23 常用配置

#!/usr/bin/env ruby

COMMIT_MSG_MAX_LENGTH = 141
COMMIT_FORMAT_POLICY_TAG = "[COMMIT_FORMAT_POLICY] ERROR::"
COMMIT_ERROR_BANNER = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
$COMMIT_FORMAT_REGEX =  /^(chore|docs|feat|fix|refactor|style|test)\: \[[A-z0-9\s&]+\] #(((MCK)-\d+)|((CAF[A-z0-9\s&]+)-\d+)|(N\/A)|(\d+)) [\sA-z0-9\-\.,_\"]+$/

message_file = ARGV[0]
message = File.read(message_file)

if message.include? "This reverts commit"
  exit 0
end

if message.include? "It looks like you may be committing a cherry-pick"
  exit 0
end

if message.start_with? "Merge branch"
  exit 0
end

if message.length > COMMIT_MSG_MAX_LENGTH
  puts COMMIT_ERROR_BANNER
  puts "#{COMMIT_FORMAT_POLICY_TAG} Commit message length #{message.length} exceeds the maximum allowed length: #{COMMIT_MSG_MAX_LENGTH}."
  puts COMMIT_ERROR_BANNER
  exit 1
end

if !$COMMIT_FORMAT_REGEX.match(message)
  puts COMMIT_ERROR_BANNER
  puts "#{COMMIT_FORMAT_POLICY_TAG} Commit message format invalid. Please follow the format as follows:"
  puts "chore|docs|feat|fix|refactor|style|test: [module name] #jira_issue_code your_commit_message."
  puts "E.g."
  puts "fix:[module name] #123  error message not displaying correctly when WIP creation failed."
  puts "Or:"
  puts "fix:[module name] #N/A publish the correct version of accessory import template."
  puts "Verb list:"
  puts "  feat     - new feature for the USER, not a new feature for build script"
  puts "  fix      - bug fix for the USER, not a fix to a build script"
  puts "  refactor - refactoring production code e.g. renaming a variable"
  puts "  test     - adding missing tests, refactoring tests, no production code change"
  puts "  chore    - updating gradle version etc., no production code change"
  puts "  style    - CODE style (not front-end style), code formatting, missing semicolon etc.,"
  puts "             no production code change"
  puts "  docs     - changes to the documentation, comment etc."
  puts "Reference: https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716"
  puts COMMIT_ERROR_BANNER
  exit 1
end

 

 

#!/bin/sh

# An example hook script to verify what is about to be pushed.  Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed.  If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
#   <local ref> <local sha1> <remote ref> <remote sha1>
#
# This sample shows how to prevent push of commits where the log message starts
# with "WIP" (work in progress).

remote="$1"
url="$2"

echo "You are push code to $url"
echo "First we run build to assure your code is right. If you want to skip it, please run git push with --no-verify."
./gradlew clean ktlint assembleDevRelease

 

 

使用了自定义控件那么要保证它们不参与混淆
使用了枚举要保证枚举不被混淆
对第三方库中的类不进行混淆
运用了反射的类也不进行混淆
使用了 Gson 之类的工具要使 JavaBean 类即实体类不被混淆
在引用第三方库的时候,一般会标明库的混淆规则的,建议在使用的时候就把混淆规则添加上去,免得到最后才去找
有用到 WebView 的 JS 调用也需要保证写的接口方法不混淆,原因和第一条一样
Parcelable 的子类和 Creator 静态成员变量不混淆,否则会产生 Android.os.BadParcelableException 异常
使用的四大组件,自定义的Application* 实体类
JNI中调用的类
Layout布局使用的View构造函数(自定义控件)、android:onClick等。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值