|
10 | 10 | StrOrCallable = Union[str, Callable[[], str]] |
11 | 11 | """The type should be either a string or a callable that returns a string.""" |
12 | 12 |
|
| 13 | +IntOrCallable = Union[int, Callable[[], int]] |
| 14 | +"""The type should be either an int or a callable that returns an int.""" |
| 15 | + |
13 | 16 | DEFAULT_CONFIG_FILE_NAME = ".clgen" |
14 | 17 | """Base default configuration file name""" |
15 | 18 |
|
|
34 | 37 | ] |
35 | 38 |
|
36 | 39 | DEFAULT_IGNORE_PATTERNS = [ |
37 | | - "[@!]minor" |
38 | | - "[@!]cosmetic" |
39 | | - "[@!]refactor" |
40 | | - "[@!]wip" |
41 | | - "[Ff]irst commit" |
42 | | - "[Ii]nitial commit" |
43 | | - "^$" # ignore commits with empty messages |
44 | | - "^Merge branch" |
45 | | - "^Merge pull" |
| 40 | + "[@!]minor", |
| 41 | + "[@!]cosmetic", |
| 42 | + "[@!]refactor", |
| 43 | + "[@!]wip", |
| 44 | + "^$", # ignore commits with empty messages |
| 45 | + "^Merge branch", |
| 46 | + "^Merge pull", |
46 | 47 | ] |
47 | 48 |
|
48 | 49 | DEFAULT_SECTION_PATTERNS = { |
49 | 50 | "New": [r"(?i)^(?:new|add)[^\n]*$"], |
50 | | - "Updates": [r"(?i)^(?:update|change|rename|remove|delete|improve|refactor)[^\n]*$"], |
| 51 | + "Updates": [r"(?i)^(?:update|change|rename|remove|delete|improve|refactor|chg)[^\n]*$"], |
51 | 52 | "Fixes": [r"(?i)^(?:fix)[^\n]*$"], |
52 | 53 | "Other": None, # Match all lines |
53 | 54 | } |
|
56 | 57 | DEFAULT_STARTING_TAG_PIPELINE = [ |
57 | 58 | {"action": "ReadFile", "kwargs": {"filename": "CHANGELOG.md"}}, |
58 | 59 | { |
59 | | - "action": "GetFirstRegExMatch", |
| 60 | + "action": "FirstRegExMatch", |
60 | 61 | "kwargs": { |
61 | | - "pattern": r"^## (?P<rev>[0-9]+\.[0-9]+(?:\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)$", |
| 62 | + "pattern": r"(?im)^## (?P<rev>\d+\.\d+(?:\.\d+)?)\s+\(\d+-\d{2}-\d{2}\)$", |
62 | 63 | "named_subgroup": "rev", |
63 | 64 | }, |
64 | 65 | }, |
|
84 | 85 | } |
85 | 86 | ] |
86 | 87 |
|
| 88 | +DEFAULT_OUTPUT_PIPELINE = [ |
| 89 | + { |
| 90 | + "action": "IncrementalFileInsert", |
| 91 | + "kwargs": { |
| 92 | + "filename": "CHANGELOG.md", |
| 93 | + "last_heading_pattern": r"(?im)^## \d+\.\d+(?:\.\d+)?\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)$", |
| 94 | + }, |
| 95 | + }, |
| 96 | +] |
| 97 | + |
87 | 98 |
|
88 | 99 | @dataclass |
89 | 100 | class Configuration: |
@@ -128,6 +139,9 @@ class Configuration: |
128 | 139 | section_patterns: dict = field(default_factory=dict) |
129 | 140 | """Group commits into groups if they match any of these regular expressions.""" |
130 | 141 |
|
| 142 | + valid_author_tokens: list = field(default_factory=list) |
| 143 | + """Tokens in git commit trailers that indicate authorship.""" |
| 144 | + |
131 | 145 | def update_from_file(self, filename: Path): |
132 | 146 | """Updates the configuration from a YAML file.""" |
133 | 147 | file_path = filename.expanduser().resolve() |
@@ -156,6 +170,7 @@ def get_default_config() -> Configuration: |
156 | 170 | body_pipeline=DEFAULT_BODY_PIPELINE, |
157 | 171 | subject_pipeline=DEFAULT_SUBJECT_PIPELINE, |
158 | 172 | starting_tag_pipeline=DEFAULT_STARTING_TAG_PIPELINE, |
| 173 | + output_pipeline=DEFAULT_OUTPUT_PIPELINE, |
159 | 174 | ) |
160 | 175 |
|
161 | 176 |
|
|
0 commit comments