|
23 | 23 | LARGE_FILE_MARKER = 'LARGE_FILE' |
24 | 24 | # No jira marker in commit message |
25 | 25 | 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' |
26 | 28 | # Check file content if it has these extensions |
27 | 29 | CHECKED_EXTS = [ |
28 | 30 | '.bat', |
@@ -571,8 +573,8 @@ def check_username(): |
571 | 573 |
|
572 | 574 |
|
573 | 575 | 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}".') |
576 | 578 | return 1 |
577 | 579 |
|
578 | 580 | if '\t' in data: |
@@ -737,7 +739,7 @@ def check_content(files): |
737 | 739 | 3. It's a text file |
738 | 740 |
|
739 | 741 | 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) |
741 | 743 | 2. It does not contain tab |
742 | 744 | 3. For C / C++ source files: |
743 | 745 | a. It has no missing newline at the end |
@@ -816,7 +818,7 @@ def _test(input, is_good=True): |
816 | 818 | self.assertEqual(rc == 0, is_good) |
817 | 819 | _test('ABC-1234') |
818 | 820 | _test('Some changes for ABC-1234 ticket') |
819 | | - _test('Trivail change NO_JIRA') |
| 821 | + _test('Trivial change NO_JIRA') |
820 | 822 | _test("Merge branch 'main' into my_branch") |
821 | 823 | _test("Merge branch 'branch_1' into branch_2") |
822 | 824 | _test('I forgot to add the jira marker!', False) |
|
0 commit comments