File tree 2 files changed +7
-6
lines changed
2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -78,14 +78,15 @@ def process_file(path: str) -> str:
78
78
return msg
79
79
80
80
81
- def process_pattern (pattern : str ) -> Pattern :
81
+ def process_pattern (pattern_str : str ) -> Pattern :
82
82
"""Verify regex pattern and return the pattern object
83
83
"""
84
84
try :
85
- pattern = re .compile (pattern )
85
+ print (f"Incoming Pattern: { pattern_str } " )
86
+ pattern = re .compile (pattern_str )
86
87
except Exception as e :
87
88
raise argparse .ArgumentTypeError (
88
- f"'{ pattern } ' is not a valid regex pattern\n { e } "
89
+ f"'{ pattern_str } ' is not a valid regex pattern\n { e } "
89
90
)
90
91
91
92
return pattern
@@ -102,11 +103,11 @@ def check():
102
103
return check
103
104
104
105
105
- def message_pattern_match (msg : str , pattern : str ) -> Result :
106
+ def message_pattern_match (msg : str , pattern : Pattern ) -> Result :
106
107
"""Verify the commit message matches the pattern
107
108
"""
108
109
def check ():
109
- if not re .match (pattern , msg ):
110
+ if not pattern .match (msg ):
110
111
# Fail the commit message
111
112
return Result (f"Commit Message does not match pattern\n \t { pattern } \n \t { msg } " , FAIL )
112
113
Original file line number Diff line number Diff line change 1
1
[metadata]
2
2
name = commit-msg-regex-hook
3
- version = v0.0.6
3
+ version = v0.0.7
4
4
author = David Tippett
5
5
description = Checks if commit message matches supplied regex
6
6
long_description = file: README.md
You can’t perform that action at this time.
0 commit comments