Skip to content

Commit 36d76a9

Browse files
committedApr 20, 2021
Relax the JIRA ID pattern to cover all projects and future need (BLD-5704)
1 parent 193cafb commit 36d76a9

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed
 

Diff for: ‎main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
if __name__ == '__main__':
1717

1818
message = os.getenv('INPUT_COMMITMESSAGE')
19-
print(f'Commit message: {message}')
2019

2120
print(f'Checking commit {githooks.get_sha()} by {githooks.get_user()} in {githooks.get_branch()}')
21+
print(f'Commit message: {message}')
2222

2323
files = githooks.get_commit_files()
2424
print(f'Checking {githooks.get_event()} modified files:')

Diff for: ‎main/githooks.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ def check_commit_msg(message, files):
781781
return 1
782782

783783
return 0
784-
jira_id_pattern = re.compile(r'\b[A-Z]{2,5}-[0-9]{1,4}\b')
784+
jira_id_pattern = re.compile(r'\b[A-Z]{2,8}-[0-9]{1,5}\b')
785785

786786

787787
class TestJiraIDPattern(unittest.TestCase):
@@ -790,15 +790,20 @@ def _test(input, is_jira=True):
790790
m = jira_id_pattern.search(input)
791791
self.assertEqual(bool(m), is_jira)
792792
_test('BLD-5704')
793+
_test('CQ-1')
794+
_test('CQ-12345')
795+
_test('SKETCHER-1')
796+
_test('SKETCHER-12345')
793797
_test("BLD-1234 fixed some builds")
794798
_test("fixed some builds BLD-1234 ")
795799
_test("fixed some builds (Jira BLD-1234)")
796800
_test("fixed some builds\n some more text BLD-1234")
797801
_test('lower-1234', False)
798802
_test('A-1234', False)
799-
_test('ABCDEF-1234', False)
800-
_test('BLD-12345', False)
801-
_test('wordBLD-1234word', False)
803+
_test('ABCDEFGHI-1234', False)
804+
_test('BLD-123456', False)
805+
_test('wordBLD-1234', False)
806+
_test('BLD-1234word', False)
802807

803808

804809
def commit_hook(merge=False):

0 commit comments

Comments
 (0)
Please sign in to comment.