Skip to content

Commit b3b35b4

Browse files
committed
Replace get_config().valid_author_tokens with instance-level valid_author_tokens in Context
1 parent 0990d06 commit b3b35b4

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

generate_changelog/context.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from dataclasses import dataclass, field
77
from typing import Callable, List, Optional, Tuple
88

9-
from generate_changelog.configuration import Configuration, get_config
9+
from generate_changelog.configuration import Configuration
1010
from generate_changelog.utilities import diff_index
1111

1212

@@ -38,6 +38,9 @@ class CommitContext:
3838
files: set = field(default_factory=set)
3939
"""The file paths (relative to the repository root) modified by this commit."""
4040

41+
valid_author_tokens: List[str] = field(default_factory=list)
42+
"""The configured tokens in git commit trailers that indicate authorship."""
43+
4144
_authors: Optional[list] = field(init=False) # list of dicts with name and email keys
4245
_author_names: Optional[list] = field(init=False) # list of just the names
4346

@@ -64,7 +67,7 @@ def authors(self) -> list:
6467

6568
raw_authors = [self.committer]
6669
trailers = self.metadata.get("trailers", collections.defaultdict(list))
67-
for token in get_config().valid_author_tokens:
70+
for token in self.valid_author_tokens:
6871
raw_authors.extend(trailers.get(token, []))
6972
author_regex = re.compile(r"^(?P<name>[^<]+)\s+(?:<(?P<email>[^>]+)>)?$")
7073

0 commit comments

Comments
 (0)