conventional-pre-commit 3.4.0__tar.gz → 3.5.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 (41) hide show
  1. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/.pre-commit-config.yaml +4 -4
  2. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/PKG-INFO +1 -1
  3. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/conventional_pre_commit/format.py +4 -1
  4. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/conventional_pre_commit.egg-info/PKG-INFO +1 -1
  5. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/test_format.py +1 -1
  6. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/test_hook.py +30 -0
  7. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/.devcontainer/Dockerfile +0 -0
  8. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/.devcontainer/compose.yml +0 -0
  9. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/.devcontainer/devcontainer.json +0 -0
  10. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/.dockerignore +0 -0
  11. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/.flake8 +0 -0
  12. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/.github/dependabot.yaml +0 -0
  13. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/.github/workflows/release.yml +10 -10
  14. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/.github/workflows/tests.yml +0 -0
  15. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/.gitignore +0 -0
  16. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/.pre-commit-hooks.yaml +0 -0
  17. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/.vscode/settings.json +0 -0
  18. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/LICENSE +0 -0
  19. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/README.md +0 -0
  20. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/conventional_pre_commit/__init__.py +0 -0
  21. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/conventional_pre_commit/hook.py +0 -0
  22. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/conventional_pre_commit.egg-info/SOURCES.txt +0 -0
  23. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/conventional_pre_commit.egg-info/dependency_links.txt +0 -0
  24. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/conventional_pre_commit.egg-info/entry_points.txt +0 -0
  25. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/conventional_pre_commit.egg-info/requires.txt +0 -0
  26. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/conventional_pre_commit.egg-info/top_level.txt +0 -0
  27. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/pyproject.toml +0 -0
  28. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/setup.cfg +0 -0
  29. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/__init__.py +0 -0
  30. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/conftest.py +0 -0
  31. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/messages/bad_commit +0 -0
  32. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/messages/conventional_commit +0 -0
  33. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/messages/conventional_commit_bad_multi_line +0 -0
  34. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/messages/conventional_commit_gbk +0 -0
  35. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/messages/conventional_commit_multi_line +0 -0
  36. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/messages/conventional_commit_utf-8 +0 -0
  37. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/messages/conventional_commit_with_multiple_scopes +0 -0
  38. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/messages/conventional_commit_with_scope +0 -0
  39. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/messages/custom_commit +0 -0
  40. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/messages/fixup_commit +0 -0
  41. {conventional_pre_commit-3.4.0 → conventional_pre_commit-3.5.0}/tests/run.sh +0 -0
@@ -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: v4.6.0
11
+ rev: v5.0.0
12
12
  hooks:
13
13
  - id: trailing-whitespace
14
14
  - id: mixed-line-ending
@@ -18,21 +18,21 @@ repos:
18
18
  - id: check-added-large-files
19
19
 
20
20
  - repo: https://github.com/psf/black
21
- rev: 24.4.2
21
+ rev: 24.10.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.1.0
28
+ rev: 7.1.1
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.7.9
35
+ rev: 1.7.10
36
36
  hooks:
37
37
  - id: bandit
38
38
  args: ["-ll"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: conventional_pre_commit
3
- Version: 3.4.0
3
+ Version: 3.5.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
@@ -39,7 +39,10 @@ def r_scope(optional=True, scopes: Optional[List[str]] = None):
39
39
 
40
40
  if scopes:
41
41
  scopes_pattern = _get_scope_pattern(scopes)
42
- return scopes_pattern
42
+ if optional:
43
+ return f"(?:{scopes_pattern})?"
44
+ else:
45
+ return scopes_pattern
43
46
 
44
47
  if optional:
45
48
  return r"(\([\w \/:,-]+\))?"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: conventional_pre_commit
3
- Version: 3.4.0
3
+ Version: 3.5.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
@@ -66,7 +66,7 @@ def test_r_scope__special_chars():
66
66
 
67
67
  def test_r_scope__scopes():
68
68
  scopes_input = ["api", "client"]
69
- result = format.r_scope(scopes=scopes_input)
69
+ result = format.r_scope(scopes=scopes_input, optional=False)
70
70
  regex = re.compile(result)
71
71
  assert regex.match("(api)")
72
72
  assert regex.match("(client)")
@@ -152,6 +152,36 @@ def test_subprocess_fail__conventional_with_multiple_scopes(cmd, conventional_co
152
152
  assert result == RESULT_FAIL
153
153
 
154
154
 
155
+ def test_main_success__custom_scopes_optional_scope(conventional_commit_path):
156
+ result = main(["--scopes", "api,client", conventional_commit_path])
157
+ assert result == RESULT_SUCCESS
158
+
159
+
160
+ def test_main_success__custom_scopes_with_allowed_scope(conventional_commit_with_multiple_scopes_path):
161
+ result = main(["--scopes", "chore,api,client", conventional_commit_with_multiple_scopes_path])
162
+ assert result == RESULT_SUCCESS
163
+
164
+
165
+ def test_main_fail__custom_scopes_with_disallowed_scope(conventional_commit_with_scope_path):
166
+ result = main(["--scopes", "api,client", conventional_commit_with_scope_path])
167
+ assert result == RESULT_FAIL
168
+
169
+
170
+ def test_main_fail__custom_scopes_require_scope_no_scope(conventional_commit_path):
171
+ result = main(["--scopes", "chore,feat,fix,custom", "--force-scope", conventional_commit_path])
172
+ assert result == RESULT_FAIL
173
+
174
+
175
+ def test_main_success__custom_scopes_require_scope_with_allowed_scope(conventional_commit_with_scope_path):
176
+ result = main(["--scopes", "api,client,scope", "--force-scope", conventional_commit_with_scope_path])
177
+ assert result == RESULT_SUCCESS
178
+
179
+
180
+ def test_main_fail__custom_scopes_require_scope_with_disallowed_scope(conventional_commit_with_scope_path):
181
+ result = main(["--scopes", "api,client", "--force-scope", conventional_commit_with_scope_path])
182
+ assert result == RESULT_FAIL
183
+
184
+
155
185
  def test_subprocess_success__fixup_commit(cmd, fixup_commit_path):
156
186
  result = subprocess.call((cmd, fixup_commit_path))
157
187
 
@@ -36,16 +36,6 @@ jobs:
36
36
  - name: Build package
37
37
  run: python -m build
38
38
 
39
- - name: Release
40
- id: release
41
- uses: softprops/action-gh-release@v2
42
- with:
43
- files: |
44
- ./dist/*.whl
45
- ./dist/*.tar.gz
46
- prerelease: ${{ contains(github.ref, '-pre') }}
47
- generate_release_notes: ${{ !contains(github.ref, '-pre') }}
48
-
49
39
  - name: Publish to Test PyPI
50
40
  uses: pypa/gh-action-pypi-publish@release/v1
51
41
  if: ${{ contains(github.ref, '-pre') }}
@@ -60,3 +50,13 @@ jobs:
60
50
  if: ${{ !contains(github.ref, '-pre') }}
61
51
  with:
62
52
  print-hash: true
53
+
54
+ - name: Release
55
+ id: release
56
+ uses: softprops/action-gh-release@v2
57
+ with:
58
+ files: |
59
+ ./dist/*.whl
60
+ ./dist/*.tar.gz
61
+ prerelease: ${{ contains(github.ref, '-pre') }}
62
+ generate_release_notes: ${{ !contains(github.ref, '-pre') }}