Skip to content

Commit 62027e4

Browse files
committed
Work around the do not commit check; and fixed a spelling
1 parent d6b1a3b commit 62027e4

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

main/githooks.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
LARGE_FILE_MARKER = 'LARGE_FILE'
2424
# No jira marker in commit message
2525
NO_JIRA_MARKER = 'NO_JIRA'
26+
# A marker to represent it's a change we don't want to commit
27+
DO_NOT_COMMIT = 'do not' + ' commit'
2628
# Check file content if it has these extensions
2729
CHECKED_EXTS = [
2830
'.bat',
@@ -571,8 +573,8 @@ def check_username():
571573

572574

573575
def check_file_content(filename, data):
574-
if 'do not commit' in data.lower():
575-
_fail(f'Found DO NOT COMMIT in "{filename}".')
576+
if DO_NOT_COMMIT in data.lower():
577+
_fail(f'Found {DO_NOT_COMMIT.upper()} in "{filename}".')
576578
return 1
577579

578580
if '\t' in data:
@@ -737,7 +739,7 @@ def check_content(files):
737739
3. It's a text file
738740
739741
We check that:
740-
1. It does non contain "DO NOT COMMIT" (case insensitive)
742+
1. It does not contain DO_NOT_COMMIT (case insensitive)
741743
2. It does not contain tab
742744
3. For C / C++ source files:
743745
a. It has no missing newline at the end
@@ -816,7 +818,7 @@ def _test(input, is_good=True):
816818
self.assertEqual(rc == 0, is_good)
817819
_test('ABC-1234')
818820
_test('Some changes for ABC-1234 ticket')
819-
_test('Trivail change NO_JIRA')
821+
_test('Trivial change NO_JIRA')
820822
_test("Merge branch 'main' into my_branch")
821823
_test("Merge branch 'branch_1' into branch_2")
822824
_test('I forgot to add the jira marker!', False)

0 commit comments

Comments
 (0)