commit-check 2.20.1__py3-none-any.whl → 2.20.2__py3-none-any.whl
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.
- commit_check/engine.py +1 -1
- commit_check/main.py +14 -5
- commit_check/rules_catalog.py +1 -1
- {commit_check-2.20.1.dist-info → commit_check-2.20.2.dist-info}/METADATA +4 -4
- {commit_check-2.20.1.dist-info → commit_check-2.20.2.dist-info}/RECORD +9 -9
- {commit_check-2.20.1.dist-info → commit_check-2.20.2.dist-info}/WHEEL +0 -0
- {commit_check-2.20.1.dist-info → commit_check-2.20.2.dist-info}/entry_points.txt +0 -0
- {commit_check-2.20.1.dist-info → commit_check-2.20.2.dist-info}/licenses/LICENSE +0 -0
- {commit_check-2.20.1.dist-info → commit_check-2.20.2.dist-info}/top_level.txt +0 -0
commit_check/engine.py
CHANGED
|
@@ -131,7 +131,7 @@ class ValidationContext:
|
|
|
131
131
|
# commits the remote lacks, so a ref pushed alongside it -- a tag that
|
|
132
132
|
# ``git push --follow-tags`` sends after a branch -- is not in the line.
|
|
133
133
|
push_from_pre_commit: bool = False
|
|
134
|
-
# Set by --ai-only: the text is not a commit message (a pull request
|
|
134
|
+
# Set by --ai-attribution-only: the text is not a commit message (a pull request
|
|
135
135
|
# description, say), so advice must not tell the reader to re-commit.
|
|
136
136
|
not_a_commit: bool = False
|
|
137
137
|
|
commit_check/main.py
CHANGED
|
@@ -191,12 +191,19 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
191
191
|
)
|
|
192
192
|
|
|
193
193
|
check_group.add_argument(
|
|
194
|
-
"--ai-only",
|
|
194
|
+
"--ai-attribution-only",
|
|
195
195
|
action="store_true",
|
|
196
196
|
help="check only the AI attribution of the message (CC013 to CC016), "
|
|
197
197
|
"for text that is not a commit message, such as a pull request "
|
|
198
198
|
"description; implies --message",
|
|
199
199
|
)
|
|
200
|
+
# The name it shipped with in 2.20.1, kept so existing scripts still work.
|
|
201
|
+
check_group.add_argument(
|
|
202
|
+
"--ai-only",
|
|
203
|
+
dest="ai_attribution_only",
|
|
204
|
+
action="store_true",
|
|
205
|
+
help=argparse.SUPPRESS,
|
|
206
|
+
)
|
|
200
207
|
|
|
201
208
|
check_group.add_argument(
|
|
202
209
|
"-b",
|
|
@@ -688,7 +695,9 @@ def _get_requested_checks(args: argparse.Namespace) -> set[str]:
|
|
|
688
695
|
requested_checks: set[str] = set()
|
|
689
696
|
|
|
690
697
|
if args.message:
|
|
691
|
-
requested_checks |=
|
|
698
|
+
requested_checks |= (
|
|
699
|
+
AI_TEXT_CHECKS if args.ai_attribution_only else MESSAGE_CHECKS
|
|
700
|
+
)
|
|
692
701
|
if args.branch:
|
|
693
702
|
requested_checks |= BRANCH_CHECKS
|
|
694
703
|
if args.tag:
|
|
@@ -742,7 +751,7 @@ def _run_json_output(
|
|
|
742
751
|
"checks": [o.to_dict() for o in outcomes],
|
|
743
752
|
}
|
|
744
753
|
if args.message:
|
|
745
|
-
report["ai_tools"] = ai_tools_in(context, author=not args.
|
|
754
|
+
report["ai_tools"] = ai_tools_in(context, author=not args.ai_attribution_only)
|
|
746
755
|
print(json.dumps(report, indent=2))
|
|
747
756
|
# Only a failure is an error. A skipped run validated nothing, but that
|
|
748
757
|
# is not a policy violation, so it must not turn into a non-zero exit.
|
|
@@ -759,7 +768,7 @@ def main() -> int:
|
|
|
759
768
|
|
|
760
769
|
try:
|
|
761
770
|
# Handle positional commit_msg_file argument for pre-commit compatibility
|
|
762
|
-
if args.commit_msg_file or args.
|
|
771
|
+
if args.commit_msg_file or args.ai_attribution_only:
|
|
763
772
|
args.message = True
|
|
764
773
|
|
|
765
774
|
if args.rev is not None:
|
|
@@ -870,7 +879,7 @@ def main() -> int:
|
|
|
870
879
|
and (stdin_content is None or stdin_is_message),
|
|
871
880
|
stdin_is_message=stdin_is_message,
|
|
872
881
|
push_from_pre_commit=push_from_pre_commit,
|
|
873
|
-
not_a_commit=args.
|
|
882
|
+
not_a_commit=args.ai_attribution_only,
|
|
874
883
|
)
|
|
875
884
|
|
|
876
885
|
# Run validation – choose output mode based on --format
|
commit_check/rules_catalog.py
CHANGED
|
@@ -326,7 +326,7 @@ MESSAGE_CHECKS: frozenset[str] = frozenset(
|
|
|
326
326
|
for entry in COMMIT_RULES
|
|
327
327
|
if entry.check not in {"author_name", "author_email", "ignore_authors"}
|
|
328
328
|
)
|
|
329
|
-
#: What ``--ai-only`` runs: the AI attribution a text makes (CC013 to CC016),
|
|
329
|
+
#: What ``--ai-attribution-only`` runs: the AI attribution a text makes (CC013 to CC016),
|
|
330
330
|
#: for text that is not a commit, such as a pull request description. CC017
|
|
331
331
|
#: is left out: it judges a commit's author, which such text does not have.
|
|
332
332
|
AI_TEXT_CHECKS: frozenset[str] = frozenset(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: commit-check
|
|
3
|
-
Version: 2.20.
|
|
3
|
+
Version: 2.20.2
|
|
4
4
|
Summary: Commit policy as code for teams and AI agents: check commit messages, branch names, authors, tags, files and AI attribution.
|
|
5
5
|
Author-email: Xianpeng Shen <xianpeng.shen@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -87,7 +87,7 @@ Stop bad commits before they exist. In `.pre-commit-config.yaml`:
|
|
|
87
87
|
```yaml
|
|
88
88
|
repos:
|
|
89
89
|
- repo: https://github.com/commit-check/commit-check
|
|
90
|
-
rev: v2.
|
|
90
|
+
rev: v2.20.2
|
|
91
91
|
hooks:
|
|
92
92
|
- id: check-message
|
|
93
93
|
- id: check-branch
|
|
@@ -221,14 +221,14 @@ author is on an `ignore_authors` list: `"author dependabot[bot] is in [commit].i
|
|
|
221
221
|
|
|
222
222
|
With a message checked, the output also has `ai_tools`: the AI tools found by
|
|
223
223
|
their known signatures in the message (and by a commit's author), under any
|
|
224
|
-
`ai_attribution` policy. `--ai-only` runs only the AI rules (CC013 to CC016),
|
|
224
|
+
`ai_attribution` policy. `--ai-attribution-only` runs only the AI rules (CC013 to CC016),
|
|
225
225
|
for text that is not a commit message, such as a pull request description.
|
|
226
226
|
Under the default `ai_attribution = "ignore"` no AI rule runs, so the result
|
|
227
227
|
passes and only `ai_tools` reports what was found; set `forbid` or `disclose`
|
|
228
228
|
to enforce a policy:
|
|
229
229
|
|
|
230
230
|
```bash
|
|
231
|
-
commit-check --ai-only --format json < pr-description.md
|
|
231
|
+
commit-check --ai-attribution-only --format json < pr-description.md
|
|
232
232
|
```
|
|
233
233
|
|
|
234
234
|
Validate a commit message with the Python API, without a subprocess:
|
|
@@ -5,17 +5,17 @@ commit_check/ai_signatures_data.py,sha256=lvJDZ_-eH2RYqVn8MMry9oNXVv27u9okLawPZx
|
|
|
5
5
|
commit_check/api.py,sha256=07bvBtV8PrhZIOwCDHiHfu_7CXsX_4U2_K2xMAucd6c,12905
|
|
6
6
|
commit_check/config.py,sha256=I7yMZBJynjVUuY-GWAkuu9a59aT9fDTJsGh4znu2hDU,13941
|
|
7
7
|
commit_check/config_merger.py,sha256=52m45cPOVzQnjvxgjf8pHPbK3BKVHPrvBMmtocztU-0,13707
|
|
8
|
-
commit_check/engine.py,sha256=
|
|
8
|
+
commit_check/engine.py,sha256=x4vOON6I7IEid3M7YWhgrE9spvGwfK902myKlRc0J-0,77528
|
|
9
9
|
commit_check/fixes.py,sha256=BpbdoHsKDyw2WfsqymwYpnrW73aHdCDGr8tMF6Ho2RU,7305
|
|
10
10
|
commit_check/imperatives.py,sha256=dEd_ssu4G0j6Cann6jqPdB97lw5Adua43K0_Odg_FyA,9518
|
|
11
|
-
commit_check/main.py,sha256=
|
|
11
|
+
commit_check/main.py,sha256=Bq1ThH0KVdS1MAeNcvvBLASPEkIVD3dbyKnYF_BkTh0,30859
|
|
12
12
|
commit_check/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
commit_check/rule_builder.py,sha256=kujszrki8VKXAarrmUwOCu0Yv7QzIiu5lm5mRBAQVns,34950
|
|
14
|
-
commit_check/rules_catalog.py,sha256=
|
|
14
|
+
commit_check/rules_catalog.py,sha256=KtP64QRFSI_p3fRtaF1XDx3MUikIU__p1o-XmQBpSMY,12736
|
|
15
15
|
commit_check/util.py,sha256=dCMbRKMPiysjxcOQWOIM-vJT2DdE2BsnGDgvTJsgnFs,34486
|
|
16
|
-
commit_check-2.20.
|
|
17
|
-
commit_check-2.20.
|
|
18
|
-
commit_check-2.20.
|
|
19
|
-
commit_check-2.20.
|
|
20
|
-
commit_check-2.20.
|
|
21
|
-
commit_check-2.20.
|
|
16
|
+
commit_check-2.20.2.dist-info/licenses/LICENSE,sha256=9mdTva71kQhrpWh_nZulxrdCnUrl5c6xJYh5hdo4p_s,1070
|
|
17
|
+
commit_check-2.20.2.dist-info/METADATA,sha256=7OVmIeAbGVUFIy9IEo3H3CPjSx-A7jXP_Rw7eec1zSM,17135
|
|
18
|
+
commit_check-2.20.2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
19
|
+
commit_check-2.20.2.dist-info/entry_points.txt,sha256=YMrkFGeub-3-IanV1d9qnopXVaRQM7MA9foXKW9iZ88,86
|
|
20
|
+
commit_check-2.20.2.dist-info/top_level.txt,sha256=Wf46u-ooHBMJNHbhfrBNQw3wC5_m8wt-o_Lfbc4QpRg,13
|
|
21
|
+
commit_check-2.20.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|