git-commit-guard 0.23.0__tar.gz → 0.23.1__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 (27) hide show
  1. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/.github/workflows/lint-commits.yml +1 -1
  2. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/PKG-INFO +8 -8
  3. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/README.md +7 -7
  4. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/docs/index.html +4 -4
  5. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/src/git_commit_guard/__init__.py +6 -6
  6. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/tests/test_git_commit_guard.py +22 -0
  7. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/.editorconfig +0 -0
  8. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/.github/workflows/coverage-baseline.yml +0 -0
  9. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/.github/workflows/coverage-comment.yml +0 -0
  10. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/.github/workflows/lint-md.yml +0 -0
  11. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/.github/workflows/lint-python.yml +0 -0
  12. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/.github/workflows/lint-workflows.yml +0 -0
  13. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/.github/workflows/release.yml +0 -0
  14. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/.github/workflows/security-audit.yml +0 -0
  15. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/.github/workflows/test.yml +0 -0
  16. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/.gitignore +0 -0
  17. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/.markdownlint.json +0 -0
  18. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/.pre-commit-hooks.yaml +0 -0
  19. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/.python-version +0 -0
  20. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/LICENSE +0 -0
  21. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/action.yml +0 -0
  22. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/cliff.toml +0 -0
  23. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/docs/commit-guard-icon.svg +0 -0
  24. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/pyproject.toml +0 -0
  25. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/ruff.toml +0 -0
  26. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/tests/__init__.py +0 -0
  27. {git_commit_guard-0.23.0 → git_commit_guard-0.23.1}/uv.lock +0 -0
@@ -22,6 +22,6 @@ jobs:
22
22
  key: nltk-averaged-perceptron-tagger-punkt
23
23
  - name: Lint commits
24
24
  # yamllint disable-line rule:line-length
25
- uses: benner/commit-guard@4f989e92ddf04153ec33040da42bc2f788c71584 # v0.22.3
25
+ uses: benner/commit-guard@4fb9b57f3883d78854ffe4bbe68ddafac569f269 # v0.23.0
26
26
  with:
27
27
  range: origin/${{ github.base_ref }}..HEAD
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-commit-guard
3
- Version: 0.23.0
3
+ Version: 0.23.1
4
4
  Summary: Opinionated conventional commit message linter with imperative mood detection
5
5
  Project-URL: Homepage, https://github.com/benner/commit-guard
6
6
  Project-URL: Repository, https://github.com/benner/commit-guard
@@ -316,7 +316,7 @@ COMMIT_GUARD_GIT_TIMEOUT=30 commit-guard --range origin/main..HEAD
316
316
  In GitHub Actions, set it at the step or job level:
317
317
 
318
318
  ```yaml
319
- - uses: benner/commit-guard@v0.23.0
319
+ - uses: benner/commit-guard@v0.23.1
320
320
  env:
321
321
  COMMIT_GUARD_GIT_TIMEOUT: 30
322
322
  with:
@@ -416,7 +416,7 @@ steps:
416
416
  - uses: actions/checkout@v4
417
417
  with:
418
418
  fetch-depth: 0
419
- - uses: benner/commit-guard@v0.23.0
419
+ - uses: benner/commit-guard@v0.23.1
420
420
  ```
421
421
 
422
422
  Check all commits in a pull request:
@@ -432,7 +432,7 @@ jobs:
432
432
  - uses: actions/checkout@v4
433
433
  with:
434
434
  fetch-depth: 0
435
- - uses: benner/commit-guard@v0.23.0
435
+ - uses: benner/commit-guard@v0.23.1
436
436
  with:
437
437
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
438
438
  ```
@@ -440,7 +440,7 @@ jobs:
440
440
  Check a specific commit SHA (mirrors the positional CLI argument):
441
441
 
442
442
  ```yaml
443
- - uses: benner/commit-guard@v0.23.0
443
+ - uses: benner/commit-guard@v0.23.1
444
444
  with:
445
445
  rev: ${{ github.sha }}
446
446
  ```
@@ -458,7 +458,7 @@ jobs:
458
458
  - uses: actions/checkout@v4
459
459
  with:
460
460
  fetch-depth: 0
461
- - uses: benner/commit-guard@v0.23.0
461
+ - uses: benner/commit-guard@v0.23.1
462
462
  with:
463
463
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
464
464
  disable: signed-off,signature
@@ -478,7 +478,7 @@ jobs:
478
478
  When `output-file` is set the action exposes the path as an output:
479
479
 
480
480
  ```yaml
481
- - uses: benner/commit-guard@v0.23.0
481
+ - uses: benner/commit-guard@v0.23.1
482
482
  id: cg
483
483
  with:
484
484
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
@@ -494,7 +494,7 @@ Add to your `.pre-commit-config.yaml`:
494
494
  ---
495
495
  repos:
496
496
  - repo: https://github.com/benner/commit-guard
497
- rev: v0.23.0
497
+ rev: v0.23.1
498
498
  hooks:
499
499
  - id: commit-guard
500
500
  - id: commit-guard-signature
@@ -295,7 +295,7 @@ COMMIT_GUARD_GIT_TIMEOUT=30 commit-guard --range origin/main..HEAD
295
295
  In GitHub Actions, set it at the step or job level:
296
296
 
297
297
  ```yaml
298
- - uses: benner/commit-guard@v0.23.0
298
+ - uses: benner/commit-guard@v0.23.1
299
299
  env:
300
300
  COMMIT_GUARD_GIT_TIMEOUT: 30
301
301
  with:
@@ -395,7 +395,7 @@ steps:
395
395
  - uses: actions/checkout@v4
396
396
  with:
397
397
  fetch-depth: 0
398
- - uses: benner/commit-guard@v0.23.0
398
+ - uses: benner/commit-guard@v0.23.1
399
399
  ```
400
400
 
401
401
  Check all commits in a pull request:
@@ -411,7 +411,7 @@ jobs:
411
411
  - uses: actions/checkout@v4
412
412
  with:
413
413
  fetch-depth: 0
414
- - uses: benner/commit-guard@v0.23.0
414
+ - uses: benner/commit-guard@v0.23.1
415
415
  with:
416
416
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
417
417
  ```
@@ -419,7 +419,7 @@ jobs:
419
419
  Check a specific commit SHA (mirrors the positional CLI argument):
420
420
 
421
421
  ```yaml
422
- - uses: benner/commit-guard@v0.23.0
422
+ - uses: benner/commit-guard@v0.23.1
423
423
  with:
424
424
  rev: ${{ github.sha }}
425
425
  ```
@@ -437,7 +437,7 @@ jobs:
437
437
  - uses: actions/checkout@v4
438
438
  with:
439
439
  fetch-depth: 0
440
- - uses: benner/commit-guard@v0.23.0
440
+ - uses: benner/commit-guard@v0.23.1
441
441
  with:
442
442
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
443
443
  disable: signed-off,signature
@@ -457,7 +457,7 @@ jobs:
457
457
  When `output-file` is set the action exposes the path as an output:
458
458
 
459
459
  ```yaml
460
- - uses: benner/commit-guard@v0.23.0
460
+ - uses: benner/commit-guard@v0.23.1
461
461
  id: cg
462
462
  with:
463
463
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
@@ -473,7 +473,7 @@ Add to your `.pre-commit-config.yaml`:
473
473
  ---
474
474
  repos:
475
475
  - repo: https://github.com/benner/commit-guard
476
- rev: v0.23.0
476
+ rev: v0.23.1
477
477
  hooks:
478
478
  - id: commit-guard
479
479
  - id: commit-guard-signature
@@ -575,13 +575,13 @@ require-subject-pattern = "[A-Z]+-[0-9]+"</code></pre>
575
575
  - uses: actions/checkout@v4
576
576
  with:
577
577
  fetch-depth: 0
578
- - uses: benner/commit-guard@v0.23.0
578
+ - uses: benner/commit-guard@v0.23.1
579
579
  with:
580
580
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
581
581
  disable: signed-off,signature</code></pre>
582
582
 
583
583
  <p>Check a specific commit SHA:</p>
584
- <pre><code class="language-yaml"> - uses: benner/commit-guard@v0.23.0
584
+ <pre><code class="language-yaml"> - uses: benner/commit-guard@v0.23.1
585
585
  with:
586
586
  rev: ${{ github.sha }}</code></pre>
587
587
 
@@ -600,7 +600,7 @@ require-subject-pattern = "[A-Z]+-[0-9]+"</code></pre>
600
600
  When <code>output-file</code> is set the action exposes the path as
601
601
  a step output, making JSONL results available to subsequent steps:
602
602
  </p>
603
- <pre><code class="language-yaml"> - uses: benner/commit-guard@v0.23.0
603
+ <pre><code class="language-yaml"> - uses: benner/commit-guard@v0.23.1
604
604
  id: cg
605
605
  with:
606
606
  range: ${{ env.PR_BASE }}..${{ env.PR_HEAD }}
@@ -613,7 +613,7 @@ require-subject-pattern = "[A-Z]+-[0-9]+"</code></pre>
613
613
  <p>Add to <code>.pre-commit-config.yaml</code>:</p>
614
614
  <pre><code class="language-yaml">repos:
615
615
  - repo: https://github.com/benner/commit-guard
616
- rev: v0.23.0
616
+ rev: v0.23.1
617
617
  hooks:
618
618
  - id: commit-guard
619
619
  - id: commit-guard-signature</code></pre>
@@ -231,22 +231,22 @@ def check_imperative(desc, result):
231
231
  if not tokens:
232
232
  return
233
233
  first = tokens[0]
234
- if _NON_IMPERATIVE_SUFFIX_RE.search(first):
234
+ base = wordnet.morphy(first, wordnet.VERB)
235
+ if base is not None and base != first:
235
236
  result.error(
236
- f"expected imperative verb, got '{first}' (non-imperative suffix)",
237
+ f"expected imperative verb, got '{first}' (inflected form of '{base}')",
237
238
  check=Check.IMPERATIVE,
238
239
  )
239
240
  return
240
- base = wordnet.morphy(first, wordnet.VERB)
241
- if base is not None and base != first:
241
+ if base is None and _NON_IMPERATIVE_SUFFIX_RE.search(first):
242
242
  result.error(
243
- f"expected imperative verb, got '{first}' (inflected form of '{base}')",
243
+ f"expected imperative verb, got '{first}' (non-imperative suffix)",
244
244
  check=Check.IMPERATIVE,
245
245
  )
246
246
  return
247
247
  tagged = nltk.pos_tag(["to", *tokens])
248
248
  if tagged[1][1] != "VB":
249
- if wordnet.morphy(first, wordnet.VERB) == first:
249
+ if base == first:
250
250
  return
251
251
  if "-" in first:
252
252
  hyphen_prefix, hyphen_base = first.split("-", 1)
@@ -516,6 +516,28 @@ class TestCheckImperative:
516
516
  check_imperative("adding token refresh", r)
517
517
  assert not r.ok
518
518
 
519
+ def test_base_verb_with_ing_suffix_passes(self):
520
+ r = Result()
521
+ check_imperative("bring back --verbose flag", r)
522
+ assert r.ok
523
+
524
+ def test_base_verb_with_ed_suffix_passes(self):
525
+ r = Result()
526
+ check_imperative("embed version string in binary", r)
527
+ assert r.ok
528
+
529
+ def test_oov_gerund_still_fails(self):
530
+ # wordnet has no verb entry for 'refactoring'; suffix backstop catches it
531
+ r = Result()
532
+ check_imperative("refactoring config loader", r)
533
+ assert not r.ok
534
+ assert "non-imperative suffix" in r.errors[0][2]
535
+
536
+ def test_known_gerund_reports_inflected_form(self):
537
+ r = Result()
538
+ check_imperative("adding token refresh", r)
539
+ assert "inflected form of 'add'" in r.errors[0][2]
540
+
519
541
  def test_third_person_fails(self):
520
542
  r = Result()
521
543
  check_imperative("adds token refresh", r)