Skip to content

Commit b095411

Browse files
committed
Refactor check_commit_msg to include repo parameter and adjust JIRA check for open source contributions NO_JIRA
1 parent 02ca578 commit b095411

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

main/githooks.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ def check_content(files):
833833
return retval
834834

835835

836-
def check_commit_msg(message, files):
836+
def check_commit_msg(message, files, repo):
837837
'''Check commit message (and file size).
838838
839839
Abort if file size exceeds hard (github.com) limit.
@@ -850,9 +850,9 @@ def check_commit_msg(message, files):
850850
# Not checking for JIRA or large file in commit message generated by github
851851
return 0
852852

853-
# if re.match(r'^ccdc-opensource', repo):
854-
# # Do not check for JIRA in opensource repo as we don't want to require external contributors to do this
855-
# return 0
853+
if re.match(r'^ccdc-opensource', repo):
854+
# Do not check for JIRA in opensource repo as we don't want to require external contributors to do this
855+
return 0
856856

857857
if NO_JIRA_MARKER not in message:
858858
if jira_id_pattern.search(message) is None:
@@ -899,7 +899,7 @@ def _test(input, is_jira=True):
899899
class TestCheckCommitMessage(unittest.TestCase):
900900
def test_various_strings(self):
901901
def _test(input, is_good=True):
902-
rc = check_commit_msg(input, [])
902+
rc = check_commit_msg(input, [], "fake/repo")
903903
self.assertEqual(rc == 0, is_good)
904904
_test('ABC-1234')
905905
_test('Some changes for ABC-1234 ticket')
@@ -944,6 +944,6 @@ def commit_msg_hook():
944944
commit_message = Path(sys.argv[1]).read_text()
945945

946946
print(' Check commit message ...')
947-
retval += check_commit_msg(commit_message, files['M'] + files['A'])
947+
retval += check_commit_msg(commit_message, files['M'] + files['A'], get_repo())
948948

949949
return retval

0 commit comments

Comments
 (0)