commit-check 2.26.0__py3-none-any.whl → 2.26.1__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/ci.py +4 -2
- commit_check/main.py +21 -9
- {commit_check-2.26.0.dist-info → commit_check-2.26.1.dist-info}/METADATA +2 -2
- {commit_check-2.26.0.dist-info → commit_check-2.26.1.dist-info}/RECORD +8 -8
- {commit_check-2.26.0.dist-info → commit_check-2.26.1.dist-info}/WHEEL +0 -0
- {commit_check-2.26.0.dist-info → commit_check-2.26.1.dist-info}/entry_points.txt +0 -0
- {commit_check-2.26.0.dist-info → commit_check-2.26.1.dist-info}/licenses/LICENSE +0 -0
- {commit_check-2.26.0.dist-info → commit_check-2.26.1.dist-info}/top_level.txt +0 -0
commit_check/ci.py
CHANGED
|
@@ -230,7 +230,9 @@ def rebase_check_is_on() -> bool:
|
|
|
230
230
|
|
|
231
231
|
|
|
232
232
|
#: The description rules that turn the description check on by themselves.
|
|
233
|
-
#: CC501 waits for ``pr-body-ai-attribution``, as it did before them
|
|
233
|
+
#: CC501 waits for ``pr-body-ai-attribution``, as it did before them: without
|
|
234
|
+
#: it the description is checked with ``--ai-attribution ignore``, which
|
|
235
|
+
#: leaves the AI declaration out with the other AI rules.
|
|
234
236
|
DESCRIPTION_CHECKS = frozenset({"issue_reference", "description_min_length"})
|
|
235
237
|
|
|
236
238
|
|
|
@@ -495,7 +497,7 @@ class Job:
|
|
|
495
497
|
args = ["--ai-attribution-only"]
|
|
496
498
|
if not self.settings["pr-body-ai-attribution"]:
|
|
497
499
|
# Only the description rules were asked for: the AI attribution
|
|
498
|
-
# rules
|
|
500
|
+
# rules and the AI declaration (CC501) stay off, as before.
|
|
499
501
|
args += ["--ai-attribution", "ignore"]
|
|
500
502
|
self.check(heading, args, text=description + "\n")
|
|
501
503
|
|
commit_check/main.py
CHANGED
|
@@ -284,7 +284,8 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
284
284
|
help="check a pull or merge request description piped on stdin against "
|
|
285
285
|
"every rule a description can meet: its AI attribution (CC013 to "
|
|
286
286
|
"CC016), its AI declaration (CC501), its issue reference (CC502) and its "
|
|
287
|
-
"length (CC503), each when the config turns it on;
|
|
287
|
+
"length (CC503), each when the config turns it on; with --ai-attribution "
|
|
288
|
+
"ignore, the AI rules and the declaration are left out; implies --message",
|
|
288
289
|
)
|
|
289
290
|
# The name it shipped with in 2.20.1, kept so existing scripts still work.
|
|
290
291
|
check_group.add_argument(
|
|
@@ -824,6 +825,24 @@ def _resolve_stdin_for_non_message(
|
|
|
824
825
|
return stdin_content, False
|
|
825
826
|
|
|
826
827
|
|
|
828
|
+
def _message_checks(args: argparse.Namespace) -> set[str]:
|
|
829
|
+
"""The checks ``--message`` and the flags that imply it request."""
|
|
830
|
+
if args.pr_body:
|
|
831
|
+
checks = set(PR_BODY_CHECKS)
|
|
832
|
+
elif args.ai_attribution_only:
|
|
833
|
+
checks = set(AI_TEXT_CHECKS)
|
|
834
|
+
elif args.pr_title:
|
|
835
|
+
return set(PR_TITLE_CHECKS)
|
|
836
|
+
else:
|
|
837
|
+
return set(MESSAGE_CHECKS)
|
|
838
|
+
if args.ai_attribution == "ignore":
|
|
839
|
+
# Asked on the command line to leave the AI rules out of a
|
|
840
|
+
# description, as commit-check-ci and the GitHub Action and App do
|
|
841
|
+
# when their AI switch is off: its AI declaration (CC501) goes too.
|
|
842
|
+
checks.discard("ai_declaration")
|
|
843
|
+
return checks
|
|
844
|
+
|
|
845
|
+
|
|
827
846
|
def _get_requested_checks(args: argparse.Namespace) -> set[str]:
|
|
828
847
|
"""The validation checks the CLI flags request.
|
|
829
848
|
|
|
@@ -833,14 +852,7 @@ def _get_requested_checks(args: argparse.Namespace) -> set[str]:
|
|
|
833
852
|
requested_checks: set[str] = set()
|
|
834
853
|
|
|
835
854
|
if args.message:
|
|
836
|
-
|
|
837
|
-
requested_checks |= PR_BODY_CHECKS
|
|
838
|
-
elif args.ai_attribution_only:
|
|
839
|
-
requested_checks |= AI_TEXT_CHECKS
|
|
840
|
-
elif args.pr_title:
|
|
841
|
-
requested_checks |= PR_TITLE_CHECKS
|
|
842
|
-
else:
|
|
843
|
-
requested_checks |= MESSAGE_CHECKS
|
|
855
|
+
requested_checks |= _message_checks(args)
|
|
844
856
|
if args.branch:
|
|
845
857
|
requested_checks |= BRANCH_CHECKS
|
|
846
858
|
if args.tag:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: commit-check
|
|
3
|
-
Version: 2.26.
|
|
3
|
+
Version: 2.26.1
|
|
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
|
|
@@ -90,7 +90,7 @@ Stop bad commits before they exist. In `.pre-commit-config.yaml`:
|
|
|
90
90
|
```yaml
|
|
91
91
|
repos:
|
|
92
92
|
- repo: https://github.com/commit-check/commit-check
|
|
93
|
-
rev: v2.26.
|
|
93
|
+
rev: v2.26.1
|
|
94
94
|
hooks:
|
|
95
95
|
- id: check-message
|
|
96
96
|
- id: check-branch
|
|
@@ -6,20 +6,20 @@ commit_check/ai_policy.py,sha256=qXH5bEOM4219ZbDztcbBppq3vEqBNdSqrQVT2VsHaMA,987
|
|
|
6
6
|
commit_check/ai_signatures.py,sha256=GI2RhS-sNWN3D7Jom90taOCj9WaKXBcL5gr9c-R6IxY,12131
|
|
7
7
|
commit_check/ai_signatures_data.py,sha256=PLI4LqTkTk0NVQo3uuEVO36IPaY1RzbbBb_Xk2g7mKo,23305
|
|
8
8
|
commit_check/api.py,sha256=GYeRo2o_GgK90Srk9gaINcP8QGzXvB4atcp4ygxV2tQ,13920
|
|
9
|
-
commit_check/ci.py,sha256=
|
|
9
|
+
commit_check/ci.py,sha256=d-RJQVlJ3l6FLf2BtVGtVqctlgtZLXofrgDTqodG0OE,21721
|
|
10
10
|
commit_check/config.py,sha256=NaddFMR-nRPSpEyNN3FX0I1lq2WqF0JE7LHTlDEDe1U,14715
|
|
11
11
|
commit_check/config_merger.py,sha256=v515wd5YH2UKu3WIw5qW7wGSYU3g-B4SvKPjE_ZGMzE,16910
|
|
12
12
|
commit_check/engine.py,sha256=70zRDlLSp6yO5Qmoys8T-fASwYJF7a5STdLnkyhP44Y,122842
|
|
13
13
|
commit_check/fixes.py,sha256=BpbdoHsKDyw2WfsqymwYpnrW73aHdCDGr8tMF6Ho2RU,7305
|
|
14
14
|
commit_check/imperatives.py,sha256=dEd_ssu4G0j6Cann6jqPdB97lw5Adua43K0_Odg_FyA,9518
|
|
15
|
-
commit_check/main.py,sha256=
|
|
15
|
+
commit_check/main.py,sha256=Qbvn0XGG1YydhHyxgpE4dQkbYEVZZAG_-yyzrdYYLXo,38183
|
|
16
16
|
commit_check/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
commit_check/rule_builder.py,sha256=6NaMEAL-xhSHijNiQc1NFtVHAusVtWNA8qflznthVFc,43459
|
|
18
18
|
commit_check/rules_catalog.py,sha256=XXJxyZGG9lKDI_8K9L6SneLxA6EHgqFC_7Wa7bq3fMg,16825
|
|
19
19
|
commit_check/util.py,sha256=0-bdlOhxOQ8K3miRjbtMCeh-A19IsQtvQNlR4T-VN4I,40033
|
|
20
|
-
commit_check-2.26.
|
|
21
|
-
commit_check-2.26.
|
|
22
|
-
commit_check-2.26.
|
|
23
|
-
commit_check-2.26.
|
|
24
|
-
commit_check-2.26.
|
|
25
|
-
commit_check-2.26.
|
|
20
|
+
commit_check-2.26.1.dist-info/licenses/LICENSE,sha256=9mdTva71kQhrpWh_nZulxrdCnUrl5c6xJYh5hdo4p_s,1070
|
|
21
|
+
commit_check-2.26.1.dist-info/METADATA,sha256=DSlzHip0ofS7dd5IGeuVSjLSOxCgo1stB22_xgdn7L0,23296
|
|
22
|
+
commit_check-2.26.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
23
|
+
commit_check-2.26.1.dist-info/entry_points.txt,sha256=-4RWjQDhmngfCnTx46iCz3RrI8WZoiMZo0nhsg6hmUw,125
|
|
24
|
+
commit_check-2.26.1.dist-info/top_level.txt,sha256=Wf46u-ooHBMJNHbhfrBNQw3wC5_m8wt-o_Lfbc4QpRg,13
|
|
25
|
+
commit_check-2.26.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|