Skip to content

Commit 800557d

Browse files
authored
feat: allow # in scope (#148)
2 parents fdde5f0 + aed2b93 commit 800557d

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

conventional_pre_commit/format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def r_types(self):
126126
@property
127127
def r_scope(self):
128128
"""Regex str for an optional (scope)."""
129-
escaped_delimiters = list(map(re.escape, [":", ",", "-", "/", "."])) # type: ignore
129+
escaped_delimiters = list(map(re.escape, [":", ",", "-", "/", ".", "#"])) # type: ignore
130130
if self.scopes:
131131
scopes = self._r_or(self.scopes)
132132
delimiters_pattern = self._r_or(escaped_delimiters)

tests/test_format.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ def test_r_scope__special_chars(conventional_commit_scope_required):
444444
assert regex.match("(some:thing)")
445445
assert regex.match("(some,thing)")
446446
assert regex.match("(some.thing)")
447+
assert regex.match("(some#thing)")
447448

448449

449450
def test_r_scope__scopes(conventional_commit_scope_required):
@@ -649,6 +650,12 @@ def test_is_valid__with_scope(conventional_commit):
649650
assert conventional_commit.is_valid(input)
650651

651652

653+
def test_is_valid__with_scope_and_hash(conventional_commit):
654+
input = "feat(#scope): message"
655+
656+
assert conventional_commit.is_valid(input)
657+
658+
652659
def test_is_valid__body_multiline_body_bad_type(conventional_commit):
653660
input = """wrong: message
654661

0 commit comments

Comments
 (0)