Skip to content

Commit 4c8ce78

Browse files
committed
feat: allow # in scope
1 parent fdde5f0 commit 4c8ce78

2 files changed

Lines changed: 7 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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,12 @@ def test_is_valid__with_scope(conventional_commit):
649649
assert conventional_commit.is_valid(input)
650650

651651

652+
def test_is_valid__with_scope_and_hash(conventional_commit):
653+
input = "feat(#scope): message"
654+
655+
assert conventional_commit.is_valid(input)
656+
657+
652658
def test_is_valid__body_multiline_body_bad_type(conventional_commit):
653659
input = """wrong: message
654660

0 commit comments

Comments
 (0)