@@ -864,7 +864,11 @@ def check_commit_msg(message, files, repo):
864864 # Opt-in per repo: commit an empty marker file named
865865 # `.conventional-commits` at the repo root.
866866 if _conventional_commits_enabled ():
867- if check_conventional_commit (message ):
867+ if not conventional_commit_present (message ):
868+ _fail ('Commit message does not follow the Angular Conventional '
869+ 'Commits standard.\n '
870+ 'Expected: <type>(<scope>)?: <subject>\n '
871+ 'See https://github.com/angular/angular/blob/main/contributing-docs/commit-message-guidelines.md' )
868872 return 1
869873
870874 if (
@@ -905,8 +909,8 @@ def _conventional_commits_enabled():
905909 return (Path (repo_root ) / '.conventional-commits' ).is_file ()
906910
907911
908- def check_conventional_commit (message ):
909- '''Check if the commit message follows the Angular Conventional Commits standard.'''
912+ def conventional_commit_present (message ):
913+ '''Return True if the commit message follows the Angular Conventional Commits standard.'''
910914 # Angular Conventional Commits header: type(scope?): subject
911915 # Allowed types from @commitlint/config-angular:
912916 # build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test
@@ -918,13 +922,7 @@ def check_conventional_commit(message):
918922 r'.+' # subject
919923 )
920924 first_line = message .split ('\n ' , 1 )[0 ]
921- if not pattern .match (first_line ):
922- _fail ('Commit message does not follow the Angular Conventional '
923- 'Commits standard.\n '
924- 'Expected: <type>(<scope>)?: <subject>\n '
925- 'See https://github.com/angular/angular/blob/main/contributing-docs/commit-message-guidelines.md' )
926- return 1
927- return 0
925+ return pattern .match (first_line ) is not None
928926
929927
930928class TestJiraIDPattern (unittest .TestCase ):
0 commit comments