X-Git-Url: https://git.arvados.org/arvados-dev.git/blobdiff_plain/26d57e45a7216568795ed8566cbc5529c6fe1983..refs/heads/main:/git/hooks/coding-standards.rb diff --git a/git/hooks/coding-standards.rb b/git/hooks/coding-standards.rb index 14fb158..bc4d649 100755 --- a/git/hooks/coding-standards.rb +++ b/git/hooks/coding-standards.rb @@ -17,6 +17,11 @@ $oldrev = ARGV[1] $newrev = ARGV[2] $user = ENV['USER'] +if ENV.has_key?('GL_OPTION_SKIP_CODING_STANDARDS_CHECK') + puts "Skipping coding standards check..." + exit 0 +end + def blacklist bl if ($newrev[0,6] == '000000') # A branch is being deleted. Do not check old commits for DCO signoff! @@ -54,10 +59,10 @@ puts "(#{$refname}) (#{$oldrev[0,6]}) (#{$newrev[0,6]})" $regex = /\[ref: (\d+)\]/ $broken_commit_message = /Please enter a commit message to explain why this merge is necessary/ -$wrong_way_merge_main = /Merge( remote-tracking)? branch '([^\/]+\/)?master' into/ -$merge_main = /Merge branch '[^']+'((?! into)| into master)/ +$wrong_way_merge_main = /Merge( remote-tracking)? branch '([^\/]+\/)?main' into/ +$merge_main = /Merge branch '[^']+'((?! into)| into main)/ $pull_merge = /Merge branch 'main' of / -$refs_or_closes_or_no_issue = /(refs #|closes #|fixes #|no issue #)/i +$refs_or_closes_or_no_issue = /(refs #|closes #|fixes #|resolves #|no issue #)/i # enforced custom commit message format def check_message_format @@ -86,7 +91,7 @@ def check_message_format no_ff = true elsif $pull_merge.match(message) puts "\n[POLICY] This appears to be a git pull merge of remote main into local" - puts "main. In order to maintain a linear first-parent history of master," + puts "main. In order to maintain a linear first-parent history of main," puts "please reset your branch and remerge or rebase using the latest main.\n" puts "\n******************************************************************\n" puts "\nOffending commit: #{rev}\n" @@ -127,8 +132,8 @@ def check_message_format # this test will complain about *every* commit in the merge otherwise, obscuring # the real reason for the rejection (the no_ff merge) if not no_ff and not $refs_or_closes_or_no_issue.match(message) - puts "\n[POLICY] All commits to main must include an issue using \"refs #\" or" - puts "\"closes #\", or specify \"no issue #\"\n" + puts "\n[POLICY] All commits to main must include an issue using \"refs #\"," + puts "\"fixes #\", \"closes #\", or \"resolves #\", or specify \"no issue #\"\n" puts "\n******************************************************************\n" puts "\nOffending commit: #{rev}\n" puts "\nOffending commit message:\n\n"