File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 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:
7878 return msg
7979
8080
81- def process_pattern (pattern : str ) -> Pattern :
81+ def process_pattern (pattern_str : str ) -> Pattern :
8282 """Verify regex pattern and return the pattern object
8383 """
8484 try :
85- pattern = re .compile (pattern )
85+ print (f"Incoming Pattern: { pattern_str } " )
86+ pattern = re .compile (pattern_str )
8687 except Exception as e :
8788 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 } "
8990 )
9091
9192 return pattern
@@ -102,11 +103,11 @@ def check():
102103 return check
103104
104105
105- def message_pattern_match (msg : str , pattern : str ) -> Result :
106+ def message_pattern_match (msg : str , pattern : Pattern ) -> Result :
106107 """Verify the commit message matches the pattern
107108 """
108109 def check ():
109- if not re .match (pattern , msg ):
110+ if not pattern .match (msg ):
110111 # Fail the commit message
111112 return Result (f"Commit Message does not match pattern\n \t { pattern } \n \t { msg } " , FAIL )
112113
Original file line number Diff line number Diff line change 11[metadata]
22name = commit-msg-regex-hook
3- version = v0.0.6
3+ version = v0.0.7
44author = David Tippett
55description = Checks if commit message matches supplied regex
66long_description = file: README.md
You can’t perform that action at this time.
0 commit comments