conventional-pre-commit 3.1.0__tar.gz → 3.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.
Files changed (40) hide show
  1. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/.github/workflows/release.yml +1 -1
  2. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/.pre-commit-config.yaml +2 -2
  3. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/PKG-INFO +1 -1
  4. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/conventional_pre_commit/format.py +10 -0
  5. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/conventional_pre_commit.egg-info/PKG-INFO +1 -1
  6. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/tests/test_format.py +67 -0
  7. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/.devcontainer/Dockerfile +0 -0
  8. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/.devcontainer/compose.yml +0 -0
  9. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/.devcontainer/devcontainer.json +0 -0
  10. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/.dockerignore +0 -0
  11. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/.flake8 +0 -0
  12. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/.github/dependabot.yaml +0 -0
  13. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/.github/workflows/tests.yml +0 -0
  14. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/.gitignore +0 -0
  15. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/.pre-commit-hooks.yaml +0 -0
  16. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/.vscode/settings.json +0 -0
  17. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/LICENSE +0 -0
  18. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/README.md +0 -0
  19. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/conventional_pre_commit/__init__.py +0 -0
  20. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/conventional_pre_commit/hook.py +0 -0
  21. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/conventional_pre_commit.egg-info/SOURCES.txt +0 -0
  22. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/conventional_pre_commit.egg-info/dependency_links.txt +0 -0
  23. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/conventional_pre_commit.egg-info/entry_points.txt +0 -0
  24. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/conventional_pre_commit.egg-info/requires.txt +0 -0
  25. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/conventional_pre_commit.egg-info/top_level.txt +0 -0
  26. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/pyproject.toml +0 -0
  27. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/setup.cfg +0 -0
  28. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/tests/__init__.py +0 -0
  29. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/tests/conftest.py +0 -0
  30. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/tests/messages/bad_commit +0 -0
  31. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/tests/messages/conventional_commit +0 -0
  32. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/tests/messages/conventional_commit_bad_multi_line +0 -0
  33. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/tests/messages/conventional_commit_gbk +0 -0
  34. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/tests/messages/conventional_commit_multi_line +0 -0
  35. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/tests/messages/conventional_commit_utf-8 +0 -0
  36. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/tests/messages/conventional_commit_with_scope +0 -0
  37. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/tests/messages/custom_commit +0 -0
  38. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/tests/messages/fixup_commit +0 -0
  39. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/tests/run.sh +0 -0
  40. {conventional_pre_commit-3.1.0 → conventional_pre_commit-3.2.0}/tests/test_hook.py +0 -0
@@ -38,7 +38,7 @@ jobs:
38
38
 
39
39
  - name: Release
40
40
  id: release
41
- uses: softprops/action-gh-release@v1
41
+ uses: softprops/action-gh-release@v2
42
42
  with:
43
43
  files: |
44
44
  ./dist/*.whl
@@ -18,7 +18,7 @@ repos:
18
18
  - id: check-added-large-files
19
19
 
20
20
  - repo: https://github.com/psf/black
21
- rev: 23.12.1
21
+ rev: 24.3.0
22
22
  hooks:
23
23
  - id: black
24
24
  types:
@@ -32,7 +32,7 @@ repos:
32
32
  - python
33
33
 
34
34
  - repo: https://github.com/pycqa/bandit
35
- rev: 1.7.6
35
+ rev: 1.7.8
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.1.0
3
+ Version: 3.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
@@ -54,6 +54,15 @@ def r_autosquash_prefixes():
54
54
  return "|".join(AUTOSQUASH_PREFIXES)
55
55
 
56
56
 
57
+ def r_verbose_diff():
58
+ """Regex str for verbose diff"""
59
+ return r"(?P<diff>(^# -* >8 -*$\r?\n)(^# .*$\r?\n)+(diff ){1}(.*\r?\n)*)"
60
+
61
+
62
+ def strip_verbose_diff(input):
63
+ return re.sub(r_verbose_diff(), "", input, flags=re.MULTILINE)
64
+
65
+
57
66
  def r_comment():
58
67
  """Regex str for comment"""
59
68
  return r"^#.*\r?\n?"
@@ -77,6 +86,7 @@ def is_conventional(input, types=DEFAULT_TYPES, optional_scope=True):
77
86
 
78
87
  Optionally provide a list of additional custom types.
79
88
  """
89
+ input = strip_verbose_diff(input)
80
90
  input = strip_comments(input)
81
91
  types = conventional_types(types)
82
92
  pattern = f"^({r_types(types)}){r_scope(optional_scope)}{r_delim()}{r_subject()}{r_body()}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: conventional_pre_commit
3
- Version: 3.1.0
3
+ Version: 3.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
@@ -151,6 +151,73 @@ def test_strip_comments__spaced():
151
151
  assert result.strip() == "feat(scope): message"
152
152
 
153
153
 
154
+ def test_r_verbose_diff__has_diff():
155
+ regex = re.compile(format.r_verbose_diff(), re.MULTILINE)
156
+ input = """# ----------- >8 -----------
157
+ # Some comment
158
+ # Some comment
159
+ diff --git a/file b/file
160
+ """
161
+
162
+ assert regex.match(input)
163
+
164
+
165
+ def test_r_verbose_diff__no_diff():
166
+ regex = re.compile(format.r_verbose_diff(), re.MULTILINE)
167
+ input = """# ----------- >8 -----------
168
+ # Some comment
169
+ # Some comment
170
+ """
171
+
172
+ assert not regex.match(input)
173
+
174
+
175
+ def test_r_verbose_diff__no_extra_comments():
176
+ regex = re.compile(format.r_verbose_diff(), re.MULTILINE)
177
+ input = """# ----------- >8 -----------
178
+ diff --git a/file b/file
179
+ """
180
+
181
+ assert not regex.match(input)
182
+
183
+
184
+ def test_strip_verbose_diff__has_diff():
185
+ input = """feat(scope): message
186
+ # Please enter the commit message for your changes.
187
+
188
+ # These are comments usually added by editors, f.ex. with export EDITOR=vim
189
+ # ----------- >8 -----------
190
+ # Some comment
191
+ # Some comment
192
+ diff --git a/file b/file
193
+ """
194
+
195
+ result = format.strip_verbose_diff(input)
196
+ assert result.count("\n") == 4
197
+ assert (
198
+ result
199
+ == """feat(scope): message
200
+ # Please enter the commit message for your changes.
201
+
202
+ # These are comments usually added by editors, f.ex. with export EDITOR=vim
203
+ """
204
+ )
205
+
206
+
207
+ def test_strip_verbose_diff__no_diff():
208
+ input = """feat(scope): message
209
+ # Please enter the commit message for your changes.
210
+
211
+ # These are comments usually added by editors, f.ex. with export EDITOR=vim
212
+ # ----------- >8 -----------
213
+ # Some comment
214
+ # Some comment
215
+ """
216
+
217
+ result = format.strip_verbose_diff(input)
218
+ assert result == input
219
+
220
+
154
221
  @pytest.mark.parametrize("type", format.DEFAULT_TYPES)
155
222
  def test_is_conventional__default_type(type):
156
223
  input = f"{type}: message"