Skip to content

Commit 9ed4fdd

Browse files
committed
fix: unpack match groups() not match
1 parent fb25c86 commit 9ed4fdd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

hatch_nodejs_version/metadata_source.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ def _parse_person(self, person: dict[str, str]) -> dict[str, str]:
6767
if "email" in person:
6868
result["email"] = person["email"]
6969
else:
70-
name, email, _ = re.match(AUTHOR_PATTERN, person["name"])
70+
match = re.match(AUTHOR_PATTERN, person["name"])
71+
if match is None:
72+
raise ValueError(f"Invalid author name: {person['name']}")
73+
name, email, _ = match.groups()
7174
result = {"name": name}
7275
if email is not None:
7376
result["email"] = email
@@ -76,7 +79,10 @@ def _parse_person(self, person: dict[str, str]) -> dict[str, str]:
7679

7780
def _parse_repository(self, repository: str | dict[str, str]) -> str:
7881
if isinstance(repository, str):
79-
kind, identifier = re.match(REPOSITORY_PATTERN, repository)
82+
match = re.match(REPOSITORY_PATTERN, repository)
83+
if match is None:
84+
raise ValueError(f"Invalid repository string: {repository}")
85+
kind, identifier = match.groups()
8086
if kind is None:
8187
kind = "github"
8288
return urllib.parse.urljoin(REPOSITORY_TABLE[kind], identifier)

0 commit comments

Comments
 (0)