Skip to content

Commit 039089d

Browse files
fix: make types and scopes case-insensitive
The conventional commits specification requires implementations not to treat units of information (other than "BREAKING CHANGE") as case-sensitive.
1 parent 9d18c1c commit 039089d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

conventional_pre_commit/format.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def __init__(
121121
@property
122122
def r_types(self):
123123
"""Regex str for valid types."""
124-
return self._r_or(self.types)
124+
return f"(?i:{self._r_or(self.types)})"
125125

126126
@property
127127
def r_scope(self):
@@ -130,7 +130,7 @@ def r_scope(self):
130130
scopes = self._r_or(self.scopes)
131131
escaped_delimiters = list(map(re.escape, [":", ",", "-", "/"])) # type: ignore
132132
delimiters_pattern = self._r_or(escaped_delimiters)
133-
scope_pattern = rf"\(\s*(?:{scopes})(?:\s*(?:{delimiters_pattern})\s*(?:{scopes}))*\s*\)"
133+
scope_pattern = rf"\(\s*(?:(?i:{scopes}))(?:\s*(?:{delimiters_pattern})\s*(?:(?i:{scopes})))*\s*\)"
134134

135135
if self.scope_optional:
136136
return f"(?:{scope_pattern})?"

0 commit comments

Comments
 (0)