conventional-pre-commit 4.2.0__tar.gz → 4.4.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.
Files changed (45) hide show
  1. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/.github/workflows/release.yml +2 -2
  2. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/.github/workflows/tests.yml +2 -2
  3. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/.pre-commit-config.yaml +5 -5
  4. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/PKG-INFO +1 -1
  5. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/conventional_pre_commit/format.py +4 -3
  6. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/conventional_pre_commit.egg-info/PKG-INFO +1 -1
  7. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/conventional_pre_commit.egg-info/SOURCES.txt +1 -0
  8. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/conftest.py +5 -0
  9. conventional_pre_commit-4.4.0/tests/messages/conventional_commit_with_dots +1 -0
  10. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/test_format.py +24 -8
  11. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/test_hook.py +6 -0
  12. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/.devcontainer/Dockerfile +0 -0
  13. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/.devcontainer/devcontainer.json +0 -0
  14. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/.dockerignore +0 -0
  15. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/.flake8 +0 -0
  16. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/.github/dependabot.yaml +0 -0
  17. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/.gitignore +0 -0
  18. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/.pre-commit-hooks.yaml +0 -0
  19. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/.vscode/settings.json +0 -0
  20. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/LICENSE +0 -0
  21. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/README.md +0 -0
  22. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/compose.yml +0 -0
  23. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/conventional_pre_commit/__init__.py +0 -0
  24. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/conventional_pre_commit/hook.py +0 -0
  25. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/conventional_pre_commit/output.py +0 -0
  26. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/conventional_pre_commit.egg-info/dependency_links.txt +0 -0
  27. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/conventional_pre_commit.egg-info/entry_points.txt +0 -0
  28. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/conventional_pre_commit.egg-info/requires.txt +0 -0
  29. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/conventional_pre_commit.egg-info/top_level.txt +0 -0
  30. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/pyproject.toml +0 -0
  31. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/setup.cfg +0 -0
  32. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/__init__.py +0 -0
  33. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/messages/bad_commit +0 -0
  34. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/messages/conventional_commit +0 -0
  35. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/messages/conventional_commit_bad_multi_line +0 -0
  36. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/messages/conventional_commit_gbk +0 -0
  37. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/messages/conventional_commit_multi_line +0 -0
  38. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/messages/conventional_commit_utf-8 +0 -0
  39. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/messages/conventional_commit_with_multiple_scopes +0 -0
  40. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/messages/conventional_commit_with_scope +0 -0
  41. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/messages/custom_commit +0 -0
  42. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/messages/fixup_commit +0 -0
  43. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/messages/merge_commit +0 -0
  44. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/run.sh +0 -0
  45. {conventional_pre_commit-4.2.0 → conventional_pre_commit-4.4.0}/tests/test_output.py +0 -0
@@ -22,9 +22,9 @@ jobs:
22
22
  id-token: write
23
23
 
24
24
  steps:
25
- - uses: actions/checkout@v4
25
+ - uses: actions/checkout@v6
26
26
 
27
- - uses: actions/setup-python@v5
27
+ - uses: actions/setup-python@v6
28
28
  with:
29
29
  python-version: "3.11"
30
30
  cache: pip
@@ -25,10 +25,10 @@ jobs:
25
25
  python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
26
26
 
27
27
  steps:
28
- - uses: actions/checkout@v4
28
+ - uses: actions/checkout@v6
29
29
 
30
30
  - name: Set up Python ${{ matrix.python-version }}
31
- uses: actions/setup-python@v5
31
+ uses: actions/setup-python@v6
32
32
  with:
33
33
  python-version: ${{ matrix.python-version }}
34
34
  cache: pip
@@ -8,7 +8,7 @@ default_install_hook_types:
8
8
 
9
9
  repos:
10
10
  - repo: https://github.com/pre-commit/pre-commit-hooks
11
- rev: v5.0.0
11
+ rev: v6.0.0
12
12
  hooks:
13
13
  - id: trailing-whitespace
14
14
  - id: mixed-line-ending
@@ -17,22 +17,22 @@ repos:
17
17
  - id: check-yaml
18
18
  - id: check-added-large-files
19
19
 
20
- - repo: https://github.com/psf/black
21
- rev: 25.1.0
20
+ - repo: https://github.com/psf/black-pre-commit-mirror
21
+ rev: 26.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.2.0
28
+ rev: 7.3.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.3
35
+ rev: 1.9.3
36
36
  hooks:
37
37
  - id: bandit
38
38
  args: ["-ll"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conventional_pre_commit
3
- Version: 4.2.0
3
+ Version: 4.4.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
@@ -126,9 +126,9 @@ class ConventionalCommit(Commit):
126
126
  @property
127
127
  def r_scope(self):
128
128
  """Regex str for an optional (scope)."""
129
+ escaped_delimiters = list(map(re.escape, [":", ",", "-", "/", ".", "#"])) # type: ignore
129
130
  if self.scopes:
130
131
  scopes = self._r_or(self.scopes)
131
- escaped_delimiters = list(map(re.escape, [":", ",", "-", "/"])) # type: ignore
132
132
  delimiters_pattern = self._r_or(escaped_delimiters)
133
133
  scope_pattern = rf"\(\s*(?:(?i:{scopes}))(?:\s*(?:{delimiters_pattern})\s*(?:(?i:{scopes})))*\s*\)"
134
134
 
@@ -137,10 +137,11 @@ class ConventionalCommit(Commit):
137
137
  else:
138
138
  return scope_pattern
139
139
 
140
+ joined_delimiters = "".join(escaped_delimiters)
140
141
  if self.scope_optional:
141
- return r"(\([\w \/:,-]+\))?"
142
+ return rf"(\([\w {joined_delimiters}]+\))?"
142
143
  else:
143
- return r"(\([\w \/:,-]+\))"
144
+ return rf"(\([\w {joined_delimiters}]+\))"
144
145
 
145
146
  @property
146
147
  def r_delim(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conventional_pre_commit
3
- Version: 4.2.0
3
+ Version: 4.4.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
@@ -35,6 +35,7 @@ tests/messages/conventional_commit_bad_multi_line
35
35
  tests/messages/conventional_commit_gbk
36
36
  tests/messages/conventional_commit_multi_line
37
37
  tests/messages/conventional_commit_utf-8
38
+ tests/messages/conventional_commit_with_dots
38
39
  tests/messages/conventional_commit_with_multiple_scopes
39
40
  tests/messages/conventional_commit_with_scope
40
41
  tests/messages/custom_commit
@@ -34,6 +34,11 @@ def conventional_utf8_commit_path():
34
34
  return get_message_path("conventional_commit_utf-8")
35
35
 
36
36
 
37
+ @pytest.fixture
38
+ def conventional_commit_with_dots_path():
39
+ return get_message_path("conventional_commit_with_dots")
40
+
41
+
37
42
  @pytest.fixture
38
43
  def conventional_gbk_commit_path():
39
44
  return get_message_path("conventional_commit_gbk")
@@ -0,0 +1 @@
1
+ feat(customer.registration): adds support for oauth2
@@ -443,6 +443,8 @@ def test_r_scope__special_chars(conventional_commit_scope_required):
443
443
  assert regex.match("(some thing)")
444
444
  assert regex.match("(some:thing)")
445
445
  assert regex.match("(some,thing)")
446
+ assert regex.match("(some.thing)")
447
+ assert regex.match("(some#thing)")
446
448
 
447
449
 
448
450
  def test_r_scope__scopes(conventional_commit_scope_required):
@@ -455,6 +457,7 @@ def test_r_scope__scopes(conventional_commit_scope_required):
455
457
  assert regex.match("(api: client)")
456
458
  assert regex.match("(api/client)")
457
459
  assert regex.match("(api-client)")
460
+ assert regex.match("(api.client)")
458
461
  assert not regex.match("(test)")
459
462
  assert not regex.match("(api; client)")
460
463
 
@@ -469,6 +472,7 @@ def test_r_scope__scopes_uppercase(conventional_commit_scope_required):
469
472
  assert regex.match("(API: CLIENT)")
470
473
  assert regex.match("(API/CLIENT)")
471
474
  assert regex.match("(API-CLIENT)")
475
+ assert regex.match("(API.CLIENT)")
472
476
  assert not regex.match("(TEST)")
473
477
  assert not regex.match("(API; CLIENT)")
474
478
 
@@ -543,12 +547,10 @@ def test_match(conventional_commit):
543
547
 
544
548
 
545
549
  def test_match_multiline(conventional_commit):
546
- match = conventional_commit.match(
547
- """test(scope): subject line
550
+ match = conventional_commit.match("""test(scope): subject line
548
551
 
549
552
  body copy
550
- """
551
- )
553
+ """)
552
554
  assert isinstance(match, re.Match)
553
555
  assert match.group("type") == "test"
554
556
  assert match.group("scope") == "(scope)"
@@ -557,13 +559,21 @@ body copy
557
559
  assert match.group("body").strip() == "body copy"
558
560
 
559
561
 
562
+ def test_match_dots(conventional_commit):
563
+ match = conventional_commit.match("""feat(foo.bar): hello world""")
564
+ assert isinstance(match, re.Match)
565
+ assert match.group("type") == "feat"
566
+ assert match.group("scope") == "(foo.bar)"
567
+ assert match.group("delim") == ":"
568
+ assert match.group("subject").strip() == "hello world"
569
+ assert match.group("body").strip() == ""
570
+
571
+
560
572
  def test_match_invalid_type(conventional_commit):
561
- match = conventional_commit.match(
562
- """invalid(scope): subject line
573
+ match = conventional_commit.match("""invalid(scope): subject line
563
574
 
564
575
  body copy
565
- """
566
- )
576
+ """)
567
577
  assert isinstance(match, re.Match)
568
578
  assert match.group("type") is None
569
579
  assert match.group("scope") == ""
@@ -636,6 +646,12 @@ def test_is_valid__with_scope(conventional_commit):
636
646
  assert conventional_commit.is_valid(input)
637
647
 
638
648
 
649
+ def test_is_valid__with_scope_and_hash(conventional_commit):
650
+ input = "feat(#scope): message"
651
+
652
+ assert conventional_commit.is_valid(input)
653
+
654
+
639
655
  def test_is_valid__body_multiline_body_bad_type(conventional_commit):
640
656
  input = """wrong: message
641
657
 
@@ -54,6 +54,12 @@ def test_main_success__conventional_utf8(conventional_utf8_commit_path):
54
54
  assert result == RESULT_SUCCESS
55
55
 
56
56
 
57
+ def test_main_success__conventional_commit_with_dots_path(conventional_commit_with_dots_path):
58
+ result = main([conventional_commit_with_dots_path])
59
+
60
+ assert result == RESULT_SUCCESS
61
+
62
+
57
63
  def test_main_fail__conventional_gbk(conventional_gbk_commit_path):
58
64
  result = main([conventional_gbk_commit_path])
59
65