git-commit-guard 0.6.0__tar.gz → 0.7.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.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: Lint Markdown
3
+ on: # yamllint disable-line rule:truthy
4
+ pull_request:
5
+ permissions:
6
+ contents: read
7
+ jobs:
8
+ lint-md:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: read
12
+ pull-requests: write
13
+ steps:
14
+ - name: Checkout code
15
+ # yamllint disable-line rule:line-length
16
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
17
+ with:
18
+ persist-credentials: false
19
+ - name: Lint Markdown files with reviewdog
20
+ # yamllint disable-line rule:line-length
21
+ uses: reviewdog/action-markdownlint@3667398db9118d7e78f7a63d10e26ce454ba5f58 # v0.26.2
22
+ with:
23
+ github_token: ${{ secrets.GITHUB_TOKEN }}
24
+ reporter: github-pr-review
25
+ level: info
26
+ fail_on_error: true
@@ -10,3 +10,14 @@
10
10
  always_run: true
11
11
  pass_filenames: true
12
12
  minimum_pre_commit_version: 2.8.0
13
+
14
+ - id: commit-guard-signature
15
+ name: commit-guard (signature)
16
+ description: Verify commit is GPG/SSH signed
17
+ entry: commit-guard
18
+ args: [HEAD, --enable, signature]
19
+ language: python
20
+ stages: [post-commit]
21
+ always_run: true
22
+ pass_filenames: false
23
+ minimum_pre_commit_version: 2.8.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-commit-guard
3
- Version: 0.6.0
3
+ Version: 0.7.0
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
@@ -31,7 +31,8 @@ imperative verb.
31
31
 
32
32
  ```bash
33
33
  $ commit-guard
34
- ✗ subject does not match 'type(scope): description': Merge pull request #5 from fix/branch
34
+ ✗ subject does not match 'type(scope): description':
35
+ Merge pull request #5 from fix/branch
35
36
  ✗ missing 'Signed-off-by' trailer
36
37
  ✗ commit is not signed (GPG/SSH)
37
38
  ```
@@ -125,14 +126,19 @@ repos:
125
126
  rev: v0.1.0
126
127
  hooks:
127
128
  - id: commit-guard
129
+ - id: commit-guard-signature
128
130
  ```
129
131
 
130
- Install the hook:
132
+ Install the hooks:
131
133
 
132
134
  ```bash
133
- pre-commit install --hook-type commit-msg
135
+ pre-commit install --hook-type commit-msg --hook-type post-commit
134
136
  ```
135
137
 
138
+ `commit-guard` runs at the `commit-msg` stage and checks message format.
139
+ `commit-guard-signature` runs at the `post-commit` stage and verifies
140
+ the GPG/SSH signature after the commit object is created.
141
+
136
142
  To selectively enable or disable checks, pass `args`:
137
143
 
138
144
  ```yaml
@@ -144,10 +150,9 @@ To selectively enable or disable checks, pass `args`:
144
150
 
145
151
  commit-guard combines two strategies to detect non-imperative descriptions:
146
152
 
147
- 1. A whitelist common commit verbs (`add`, `fix`, `remove`, etc.)
148
- that pass immediately without NLP.
149
- 2. nltk POS tagging as a fallback — flags words tagged as past tense (`VBD`),
153
+ 1. nltk POS tagging flags words tagged as past tense (`VBD`),
150
154
  gerund (`VBG`), third person (`VBZ`), etc.
155
+ 2. WordNet morphology as a fallback for words the tagger misclassifies.
151
156
 
152
157
  This catches common mistakes like `added logging` or `fixes bug` while
153
158
  keeping false positives low.
@@ -10,7 +10,8 @@ imperative verb.
10
10
 
11
11
  ```bash
12
12
  $ commit-guard
13
- ✗ subject does not match 'type(scope): description': Merge pull request #5 from fix/branch
13
+ ✗ subject does not match 'type(scope): description':
14
+ Merge pull request #5 from fix/branch
14
15
  ✗ missing 'Signed-off-by' trailer
15
16
  ✗ commit is not signed (GPG/SSH)
16
17
  ```
@@ -104,14 +105,19 @@ repos:
104
105
  rev: v0.1.0
105
106
  hooks:
106
107
  - id: commit-guard
108
+ - id: commit-guard-signature
107
109
  ```
108
110
 
109
- Install the hook:
111
+ Install the hooks:
110
112
 
111
113
  ```bash
112
- pre-commit install --hook-type commit-msg
114
+ pre-commit install --hook-type commit-msg --hook-type post-commit
113
115
  ```
114
116
 
117
+ `commit-guard` runs at the `commit-msg` stage and checks message format.
118
+ `commit-guard-signature` runs at the `post-commit` stage and verifies
119
+ the GPG/SSH signature after the commit object is created.
120
+
115
121
  To selectively enable or disable checks, pass `args`:
116
122
 
117
123
  ```yaml
@@ -123,10 +129,9 @@ To selectively enable or disable checks, pass `args`:
123
129
 
124
130
  commit-guard combines two strategies to detect non-imperative descriptions:
125
131
 
126
- 1. A whitelist common commit verbs (`add`, `fix`, `remove`, etc.)
127
- that pass immediately without NLP.
128
- 2. nltk POS tagging as a fallback — flags words tagged as past tense (`VBD`),
132
+ 1. nltk POS tagging flags words tagged as past tense (`VBD`),
129
133
  gerund (`VBG`), third person (`VBZ`), etc.
134
+ 2. WordNet morphology as a fallback for words the tagger misclassifies.
130
135
 
131
136
  This catches common mistakes like `added logging` or `fixes bug` while
132
137
  keeping false positives low.
@@ -275,10 +275,7 @@ def main():
275
275
  check_body(lines, result)
276
276
  if Check.SIGNED_OFF in args.enabled:
277
277
  check_signed_off(args.message, result)
278
- if Check.SIGNATURE in args.enabled:
279
- if args.rev:
280
- check_signature(args.rev, result)
281
- else:
282
- result.warn("signature check skipped (no commit ref)")
278
+ if Check.SIGNATURE in args.enabled and args.rev:
279
+ check_signature(args.rev, result)
283
280
 
284
281
  return _report(result)
@@ -433,7 +433,7 @@ class TestMain:
433
433
  ):
434
434
  ret = main()
435
435
  assert ret == 0
436
- assert "skipped" in capsys.readouterr().err
436
+ assert "all checks passed" in capsys.readouterr().err
437
437
 
438
438
  def test_imperative_only_no_subject_check(self, tmp_path):
439
439
  # imperative enabled, subject not — desc starts as None, parsed from line