conventional-pre-commit 4.0.0__tar.gz → 4.2.0__tar.gz
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.
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/.pre-commit-config.yaml +3 -3
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/PKG-INFO +3 -2
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/conventional_pre_commit/format.py +10 -5
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/conventional_pre_commit.egg-info/PKG-INFO +3 -2
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/test_format.py +44 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/.devcontainer/Dockerfile +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/.devcontainer/devcontainer.json +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/.dockerignore +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/.flake8 +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/.github/dependabot.yaml +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/.github/workflows/release.yml +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/.github/workflows/tests.yml +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/.gitignore +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/.pre-commit-hooks.yaml +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/.vscode/settings.json +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/LICENSE +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/README.md +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/compose.yml +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/conventional_pre_commit/__init__.py +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/conventional_pre_commit/hook.py +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/conventional_pre_commit/output.py +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/conventional_pre_commit.egg-info/SOURCES.txt +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/conventional_pre_commit.egg-info/dependency_links.txt +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/conventional_pre_commit.egg-info/entry_points.txt +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/conventional_pre_commit.egg-info/requires.txt +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/conventional_pre_commit.egg-info/top_level.txt +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/pyproject.toml +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/setup.cfg +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/__init__.py +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/conftest.py +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/messages/bad_commit +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/messages/conventional_commit +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/messages/conventional_commit_bad_multi_line +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/messages/conventional_commit_gbk +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/messages/conventional_commit_multi_line +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/messages/conventional_commit_utf-8 +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/messages/conventional_commit_with_multiple_scopes +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/messages/conventional_commit_with_scope +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/messages/custom_commit +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/messages/fixup_commit +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/messages/merge_commit +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/run.sh +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/test_hook.py +0 -0
- {conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/test_output.py +0 -0
|
@@ -18,21 +18,21 @@ repos:
|
|
|
18
18
|
- id: check-added-large-files
|
|
19
19
|
|
|
20
20
|
- repo: https://github.com/psf/black
|
|
21
|
-
rev:
|
|
21
|
+
rev: 25.1.0
|
|
22
22
|
hooks:
|
|
23
23
|
- id: black
|
|
24
24
|
types:
|
|
25
25
|
- python
|
|
26
26
|
|
|
27
27
|
- repo: https://github.com/PyCQA/flake8
|
|
28
|
-
rev: 7.
|
|
28
|
+
rev: 7.2.0
|
|
29
29
|
hooks:
|
|
30
30
|
- id: flake8
|
|
31
31
|
types:
|
|
32
32
|
- python
|
|
33
33
|
|
|
34
34
|
- repo: https://github.com/pycqa/bandit
|
|
35
|
-
rev: 1.8.
|
|
35
|
+
rev: 1.8.3
|
|
36
36
|
hooks:
|
|
37
37
|
- id: bandit
|
|
38
38
|
args: ["-ll"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: conventional_pre_commit
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2.0
|
|
4
4
|
Summary: A pre-commit hook that checks commit messages for Conventional Commits formatting.
|
|
5
5
|
Author-email: Compiler LLC <dev@compiler.la>
|
|
6
6
|
License: Apache License
|
|
@@ -220,6 +220,7 @@ Requires-Dist: flake8; extra == "dev"
|
|
|
220
220
|
Requires-Dist: pre-commit; extra == "dev"
|
|
221
221
|
Requires-Dist: pytest; extra == "dev"
|
|
222
222
|
Requires-Dist: setuptools_scm; extra == "dev"
|
|
223
|
+
Dynamic: license-file
|
|
223
224
|
|
|
224
225
|
# conventional-pre-commit
|
|
225
226
|
|
{conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/conventional_pre_commit/format.py
RENAMED
|
@@ -70,11 +70,16 @@ class Commit:
|
|
|
70
70
|
|
|
71
71
|
def is_merge(self, commit_msg: str = ""):
|
|
72
72
|
"""
|
|
73
|
-
Returns True if
|
|
74
|
-
|
|
73
|
+
Returns True if the commit message indicates a merge commit.
|
|
74
|
+
Matches messages that start with "Merge", including:
|
|
75
|
+
- Merge branch ...
|
|
76
|
+
- Merge pull request ...
|
|
77
|
+
- Merge remote-tracking branch ...
|
|
78
|
+
- Merge tag ...
|
|
79
|
+
See https://git-scm.com/docs/git-merge.
|
|
75
80
|
"""
|
|
76
81
|
commit_msg = self.clean(commit_msg)
|
|
77
|
-
return
|
|
82
|
+
return bool(re.match(r"^merge\b", commit_msg.lower()))
|
|
78
83
|
|
|
79
84
|
|
|
80
85
|
class ConventionalCommit(Commit):
|
|
@@ -116,7 +121,7 @@ class ConventionalCommit(Commit):
|
|
|
116
121
|
@property
|
|
117
122
|
def r_types(self):
|
|
118
123
|
"""Regex str for valid types."""
|
|
119
|
-
return self._r_or(self.types)
|
|
124
|
+
return f"(?i:{self._r_or(self.types)})"
|
|
120
125
|
|
|
121
126
|
@property
|
|
122
127
|
def r_scope(self):
|
|
@@ -125,7 +130,7 @@ class ConventionalCommit(Commit):
|
|
|
125
130
|
scopes = self._r_or(self.scopes)
|
|
126
131
|
escaped_delimiters = list(map(re.escape, [":", ",", "-", "/"])) # type: ignore
|
|
127
132
|
delimiters_pattern = self._r_or(escaped_delimiters)
|
|
128
|
-
scope_pattern = rf"\(\s*(?:{scopes})(?:\s*(?:{delimiters_pattern})\s*(?:{scopes}))*\s*\)"
|
|
133
|
+
scope_pattern = rf"\(\s*(?:(?i:{scopes}))(?:\s*(?:{delimiters_pattern})\s*(?:(?i:{scopes})))*\s*\)"
|
|
129
134
|
|
|
130
135
|
if self.scope_optional:
|
|
131
136
|
return f"(?:{scope_pattern})?"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: conventional_pre_commit
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2.0
|
|
4
4
|
Summary: A pre-commit hook that checks commit messages for Conventional Commits formatting.
|
|
5
5
|
Author-email: Compiler LLC <dev@compiler.la>
|
|
6
6
|
License: Apache License
|
|
@@ -220,6 +220,7 @@ Requires-Dist: flake8; extra == "dev"
|
|
|
220
220
|
Requires-Dist: pre-commit; extra == "dev"
|
|
221
221
|
Requires-Dist: pytest; extra == "dev"
|
|
222
222
|
Requires-Dist: setuptools_scm; extra == "dev"
|
|
223
|
+
Dynamic: license-file
|
|
223
224
|
|
|
224
225
|
# conventional-pre-commit
|
|
225
226
|
|
|
@@ -397,8 +397,16 @@ def test_has_autosquash_prefix(commit, input, expected_result):
|
|
|
397
397
|
[
|
|
398
398
|
("Merge branch '2.x.x' into '1.x.x'", True),
|
|
399
399
|
("merge branch 'dev' into 'main'", True),
|
|
400
|
+
("Merge remote-tracking branch 'origin/master'", True),
|
|
401
|
+
("Merge pull request #123 from user/feature-branch", True),
|
|
402
|
+
("Merge tag 'v1.2.3' into main", True),
|
|
403
|
+
("Merge origin/master into develop", True),
|
|
404
|
+
("Merge refs/heads/main into develop", True),
|
|
400
405
|
("nope not a merge commit", False),
|
|
401
406
|
("type: subject", False),
|
|
407
|
+
("fix: merge bug in auth logic", False),
|
|
408
|
+
("chore: merged upstream changes", False),
|
|
409
|
+
("MergeSort implemented and tested", False),
|
|
402
410
|
],
|
|
403
411
|
)
|
|
404
412
|
def test_is_merge_commit(input, expected_result):
|
|
@@ -451,6 +459,20 @@ def test_r_scope__scopes(conventional_commit_scope_required):
|
|
|
451
459
|
assert not regex.match("(api; client)")
|
|
452
460
|
|
|
453
461
|
|
|
462
|
+
def test_r_scope__scopes_uppercase(conventional_commit_scope_required):
|
|
463
|
+
conventional_commit_scope_required.scopes = ["api", "client"]
|
|
464
|
+
regex = re.compile(conventional_commit_scope_required.r_scope)
|
|
465
|
+
|
|
466
|
+
assert regex.match("(API)")
|
|
467
|
+
assert regex.match("(CLIENT)")
|
|
468
|
+
assert regex.match("(API, CLIENT)")
|
|
469
|
+
assert regex.match("(API: CLIENT)")
|
|
470
|
+
assert regex.match("(API/CLIENT)")
|
|
471
|
+
assert regex.match("(API-CLIENT)")
|
|
472
|
+
assert not regex.match("(TEST)")
|
|
473
|
+
assert not regex.match("(API; CLIENT)")
|
|
474
|
+
|
|
475
|
+
|
|
454
476
|
def test_r_delim(conventional_commit):
|
|
455
477
|
regex = re.compile(conventional_commit.r_delim)
|
|
456
478
|
|
|
@@ -557,6 +579,13 @@ def test_is_valid__default_type(conventional_commit, type):
|
|
|
557
579
|
assert conventional_commit.is_valid(input)
|
|
558
580
|
|
|
559
581
|
|
|
582
|
+
@pytest.mark.parametrize("type", ConventionalCommit.DEFAULT_TYPES)
|
|
583
|
+
def test_is_valid__default_type_uppercase(conventional_commit, type):
|
|
584
|
+
input = f"{type.upper()}: message"
|
|
585
|
+
|
|
586
|
+
assert conventional_commit.is_valid(input)
|
|
587
|
+
|
|
588
|
+
|
|
560
589
|
@pytest.mark.parametrize("type", ConventionalCommit.CONVENTIONAL_TYPES)
|
|
561
590
|
def test_is_valid__conventional_type(conventional_commit, type):
|
|
562
591
|
input = f"{type}: message"
|
|
@@ -564,6 +593,13 @@ def test_is_valid__conventional_type(conventional_commit, type):
|
|
|
564
593
|
assert conventional_commit.is_valid(input)
|
|
565
594
|
|
|
566
595
|
|
|
596
|
+
@pytest.mark.parametrize("type", ConventionalCommit.CONVENTIONAL_TYPES)
|
|
597
|
+
def test_is_valid__conventional_type_uppercase(conventional_commit, type):
|
|
598
|
+
input = f"{type.upper()}: message"
|
|
599
|
+
|
|
600
|
+
assert conventional_commit.is_valid(input)
|
|
601
|
+
|
|
602
|
+
|
|
567
603
|
@pytest.mark.parametrize("type", CUSTOM_TYPES)
|
|
568
604
|
def test_is_valid__custom_type(type):
|
|
569
605
|
input = f"{type}: message"
|
|
@@ -580,6 +616,14 @@ def test_is_valid__conventional_custom_type(type):
|
|
|
580
616
|
assert conventional_commits.is_valid(input)
|
|
581
617
|
|
|
582
618
|
|
|
619
|
+
@pytest.mark.parametrize("type", ConventionalCommit.CONVENTIONAL_TYPES)
|
|
620
|
+
def test_is_valid__conventional_custom_type_uppercase(type):
|
|
621
|
+
input = f"{type.upper()}: message"
|
|
622
|
+
conventional_commits = ConventionalCommit(types=CUSTOM_TYPES)
|
|
623
|
+
|
|
624
|
+
assert conventional_commits.is_valid(input)
|
|
625
|
+
|
|
626
|
+
|
|
583
627
|
def test_is_valid__breaking_change(conventional_commit):
|
|
584
628
|
input = "fix!: message"
|
|
585
629
|
|
|
File without changes
|
{conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/.devcontainer/devcontainer.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/.github/workflows/release.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/conventional_pre_commit/__init__.py
RENAMED
|
File without changes
|
{conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/conventional_pre_commit/hook.py
RENAMED
|
File without changes
|
{conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/conventional_pre_commit/output.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/messages/conventional_commit
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{conventional_pre_commit-4.0.0 → conventional_pre_commit-4.2.0}/tests/messages/custom_commit
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|