commit-check 2.1.2__py3-none-any.whl → 2.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- commit_check/__init__.py +2 -0
- commit_check/rule_builder.py +16 -3
- commit_check/rules_catalog.py +1 -1
- {commit_check-2.1.2.dist-info → commit_check-2.2.0.dist-info}/METADATA +2 -1
- commit_check-2.2.0.dist-info/RECORD +14 -0
- commit_check-2.1.2.dist-info/RECORD +0 -14
- {commit_check-2.1.2.dist-info → commit_check-2.2.0.dist-info}/WHEEL +0 -0
- {commit_check-2.1.2.dist-info → commit_check-2.2.0.dist-info}/entry_points.txt +0 -0
- {commit_check-2.1.2.dist-info → commit_check-2.2.0.dist-info}/licenses/LICENSE +0 -0
- {commit_check-2.1.2.dist-info → commit_check-2.2.0.dist-info}/top_level.txt +0 -0
commit_check/__init__.py
CHANGED
commit_check/rule_builder.py
CHANGED
|
@@ -6,6 +6,7 @@ from commit_check.rules_catalog import COMMIT_RULES, BRANCH_RULES, RuleCatalogEn
|
|
|
6
6
|
from commit_check import (
|
|
7
7
|
DEFAULT_COMMIT_TYPES,
|
|
8
8
|
DEFAULT_BRANCH_TYPES,
|
|
9
|
+
DEFAULT_BRANCH_NAMES,
|
|
9
10
|
DEFAULT_BOOLEAN_RULES,
|
|
10
11
|
)
|
|
11
12
|
|
|
@@ -125,7 +126,8 @@ class RuleBuilder:
|
|
|
125
126
|
return None
|
|
126
127
|
|
|
127
128
|
allowed_types = self._get_allowed_branch_types()
|
|
128
|
-
|
|
129
|
+
allowed_names = self._get_allowed_branch_names()
|
|
130
|
+
regex = self._build_conventional_branch_regex(allowed_types, allowed_names)
|
|
129
131
|
|
|
130
132
|
return ValidationRule(
|
|
131
133
|
check=catalog_entry.check,
|
|
@@ -222,12 +224,23 @@ class RuleBuilder:
|
|
|
222
224
|
types = self.branch_config.get("allow_branch_types", DEFAULT_BRANCH_TYPES)
|
|
223
225
|
return list(dict.fromkeys(types)) # Preserve order, remove duplicates
|
|
224
226
|
|
|
227
|
+
def _get_allowed_branch_names(self) -> List[str]:
|
|
228
|
+
"""Get deduplicated list of allowed branch names."""
|
|
229
|
+
names = self.branch_config.get("allow_branch_names", DEFAULT_BRANCH_NAMES)
|
|
230
|
+
return list(dict.fromkeys(names)) # Preserve order, remove duplicates
|
|
231
|
+
|
|
225
232
|
def _build_conventional_commit_regex(self, allowed_types: List[str]) -> str:
|
|
226
233
|
"""Build regex for conventional commit messages."""
|
|
227
234
|
types_pattern = "|".join(sorted(set(allowed_types)))
|
|
228
235
|
return rf"^({types_pattern}){{1}}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)|(Merge).*|(fixup!.*)"
|
|
229
236
|
|
|
230
|
-
def _build_conventional_branch_regex(
|
|
237
|
+
def _build_conventional_branch_regex(
|
|
238
|
+
self, allowed_types: List[str], allowed_names: List[str]
|
|
239
|
+
) -> str:
|
|
231
240
|
"""Build regex for conventional branch names."""
|
|
232
241
|
types_pattern = "|".join(allowed_types)
|
|
233
|
-
|
|
242
|
+
# Build pattern for additional allowed branch names
|
|
243
|
+
base_names = ["master", "main", "HEAD", "PR-.+"]
|
|
244
|
+
all_names = base_names + allowed_names
|
|
245
|
+
names_pattern = ")|(".join(all_names)
|
|
246
|
+
return rf"^({types_pattern})\/.+|({names_pattern})"
|
commit_check/rules_catalog.py
CHANGED
|
@@ -112,7 +112,7 @@ BRANCH_RULES = [
|
|
|
112
112
|
check="branch",
|
|
113
113
|
regex=None, # Built dynamically from config
|
|
114
114
|
error="The branch should follow Conventional Branch. See https://conventional-branch.github.io/",
|
|
115
|
-
suggest="Use <type>/<description> with allowed types or ignore_authors in config branch section to bypass",
|
|
115
|
+
suggest="Use <type>/<description> with allowed types or add branch name to allow_branch_names in config, or use ignore_authors in config branch section to bypass",
|
|
116
116
|
),
|
|
117
117
|
RuleCatalogEntry(
|
|
118
118
|
check="merge_base",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: commit-check
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Check commit message formatting, branch naming, commit author, email, and more.
|
|
5
5
|
Author-email: Xianpeng Shen <xianpeng.shen@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -33,6 +33,7 @@ Requires-Dist: pytest; extra == "test"
|
|
|
33
33
|
Requires-Dist: pytest-mock; extra == "test"
|
|
34
34
|
Requires-Dist: pytest-codspeed; extra == "test"
|
|
35
35
|
Provides-Extra: docs
|
|
36
|
+
Requires-Dist: sphinx<9; extra == "docs"
|
|
36
37
|
Requires-Dist: sphinx-immaterial; extra == "docs"
|
|
37
38
|
Requires-Dist: sphinx-autobuild; extra == "docs"
|
|
38
39
|
Requires-Dist: sphinx_issues; extra == "docs"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
commit_check/__init__.py,sha256=6bUw-6fUjCN5qAxe6i4mUztQiAHpjOhyPHsegW1tbBc,1297
|
|
2
|
+
commit_check/config.py,sha256=1Th_57ekaYorJFLpSjZq-HW5U5iuVGYWBBAUj8kp9pI,961
|
|
3
|
+
commit_check/engine.py,sha256=P7hp-b5I8HwRsQPWJnKFXwTza0rXqp_xepuoN1grPqA,19340
|
|
4
|
+
commit_check/imperatives.py,sha256=b_olcxhoHW2LMHaO9COVlVUdLE-7uifo9WeSY7rPql4,3582
|
|
5
|
+
commit_check/main.py,sha256=JTlDLzUVAszcP0Faug25bIaBpUqqFG_CKkrDFOSzwB8,6977
|
|
6
|
+
commit_check/rule_builder.py,sha256=0UqMQxDiPNgqEjmRTYnyHimCA7vZRZqgqdm7ughp3DY,9205
|
|
7
|
+
commit_check/rules_catalog.py,sha256=95aXG0CzeUzEokyVwhyC5EnqCD0euDtdGlDBU2W498Y,4280
|
|
8
|
+
commit_check/util.py,sha256=bvB4w0jSdgot5eOThmn9iV1IwKjBX_B8hB2T9hhrskQ,8340
|
|
9
|
+
commit_check-2.2.0.dist-info/licenses/LICENSE,sha256=VAJ9TE1ov8aUKmeoBRYqciMs0CXag1TeDCoLhwbeQmA,1095
|
|
10
|
+
commit_check-2.2.0.dist-info/METADATA,sha256=BbavslIOcQzXNo0aKVA1FNEvsOMRp-VdUOSRH9279GM,9453
|
|
11
|
+
commit_check-2.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
12
|
+
commit_check-2.2.0.dist-info/entry_points.txt,sha256=YMrkFGeub-3-IanV1d9qnopXVaRQM7MA9foXKW9iZ88,86
|
|
13
|
+
commit_check-2.2.0.dist-info/top_level.txt,sha256=Wf46u-ooHBMJNHbhfrBNQw3wC5_m8wt-o_Lfbc4QpRg,13
|
|
14
|
+
commit_check-2.2.0.dist-info/RECORD,,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
commit_check/__init__.py,sha256=v0dHxQIC-oSKPspRnLK0lPijrJcYIZQuPIvnMW-dvss,1201
|
|
2
|
-
commit_check/config.py,sha256=1Th_57ekaYorJFLpSjZq-HW5U5iuVGYWBBAUj8kp9pI,961
|
|
3
|
-
commit_check/engine.py,sha256=P7hp-b5I8HwRsQPWJnKFXwTza0rXqp_xepuoN1grPqA,19340
|
|
4
|
-
commit_check/imperatives.py,sha256=b_olcxhoHW2LMHaO9COVlVUdLE-7uifo9WeSY7rPql4,3582
|
|
5
|
-
commit_check/main.py,sha256=JTlDLzUVAszcP0Faug25bIaBpUqqFG_CKkrDFOSzwB8,6977
|
|
6
|
-
commit_check/rule_builder.py,sha256=GaThCjaUfktkuK_1CUs4LEjnlyqCouRfRUQQ0GUwrjU,8592
|
|
7
|
-
commit_check/rules_catalog.py,sha256=FryaCoxAj9V-2c9GJGuzA8MTy8jcfgrBvN3SKlnlLHw,4224
|
|
8
|
-
commit_check/util.py,sha256=bvB4w0jSdgot5eOThmn9iV1IwKjBX_B8hB2T9hhrskQ,8340
|
|
9
|
-
commit_check-2.1.2.dist-info/licenses/LICENSE,sha256=VAJ9TE1ov8aUKmeoBRYqciMs0CXag1TeDCoLhwbeQmA,1095
|
|
10
|
-
commit_check-2.1.2.dist-info/METADATA,sha256=otDs3t0GRf4eVIMfSDtIdRsfIzqqnoBnhPSnX0QfHwU,9412
|
|
11
|
-
commit_check-2.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
12
|
-
commit_check-2.1.2.dist-info/entry_points.txt,sha256=YMrkFGeub-3-IanV1d9qnopXVaRQM7MA9foXKW9iZ88,86
|
|
13
|
-
commit_check-2.1.2.dist-info/top_level.txt,sha256=Wf46u-ooHBMJNHbhfrBNQw3wC5_m8wt-o_Lfbc4QpRg,13
|
|
14
|
-
commit_check-2.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|