Skip to content

Commit f51f662

Browse files
committed
chore: added additional delimeters for scope
Refs: #101, #102
1 parent 71bfc2a commit f51f662

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

conventional_pre_commit/format.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def r_types(types):
2929

3030
def _get_scope_pattern(scopes: Optional[List[str]] = None):
3131
scopes_str = r_types(scopes)
32-
escaped_delimiters = list(map(re.escape, [":", ","])) # type: ignore
32+
escaped_delimiters = list(map(re.escape, [":", ",", "-", "/"])) # type: ignore
3333
delimiters_pattern = r_types(escaped_delimiters)
3434
return rf"\(\s*(?:{scopes_str})(?:\s*(?:{delimiters_pattern})\s*(?:{scopes_str}))*\s*\)"
3535

@@ -92,7 +92,7 @@ def conventional_types(types=[]):
9292
return types
9393

9494

95-
def is_conventional(input, types=DEFAULT_TYPES, optional_scope=True, scopes: Optional[list[str]] = None):
95+
def is_conventional(input, types=DEFAULT_TYPES, optional_scope=True, scopes: Optional[List[str]] = None):
9696
"""
9797
Returns True if input matches Conventional Commits formatting
9898
https://www.conventionalcommits.org

tests/test_format.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ def test_r_scope__scopes():
7272
assert regex.match("(client)")
7373
assert regex.match("(api, client)")
7474
assert regex.match("(api: client)")
75+
assert regex.match("(api/client)")
76+
assert regex.match("(api-client)")
7577
assert not regex.match("(test)")
7678
assert not regex.match("(api; client)")
7779

0 commit comments

Comments
 (0)