Skip to content

Commit b79871b

Browse files
Merge pull request #32 from ccdc-opensource/remove-opensource-jira-req
Remove opensource jira req
2 parents 02ca578 + 05faaa3 commit b79871b

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@
2121
print(f'Commit message: {message}')
2222

2323
files = githooks.get_commit_files()
24+
repo = githooks.get_repo()
2425
print(f'Checking {githooks.get_event()} modified files:')
2526
print(' ' + '\n '.join(files['M']))
2627
print(f'Checking {githooks.get_event()} new files:')
2728
print(' ' + '\n '.join(files['A']))
2829

2930
retval = 0
3031

31-
retval += githooks.check_commit_msg(message, files['M'] + files['A'])
32+
retval += githooks.check_commit_msg(message, files['M'] + files['A'], repo)
3233

3334
if githooks._is_pull_request():
3435
retval += githooks.check_do_not_merge(files['M'])

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)