commit-check 2.4.0__py3-none-any.whl → 2.4.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/imperatives.py +14 -0
- commit_check/main.py +62 -38
- {commit_check-2.4.0.dist-info → commit_check-2.4.2.dist-info}/METADATA +2 -2
- {commit_check-2.4.0.dist-info → commit_check-2.4.2.dist-info}/RECORD +8 -8
- {commit_check-2.4.0.dist-info → commit_check-2.4.2.dist-info}/WHEEL +1 -1
- {commit_check-2.4.0.dist-info → commit_check-2.4.2.dist-info}/entry_points.txt +0 -0
- {commit_check-2.4.0.dist-info → commit_check-2.4.2.dist-info}/licenses/LICENSE +0 -0
- {commit_check-2.4.0.dist-info → commit_check-2.4.2.dist-info}/top_level.txt +0 -0
commit_check/imperatives.py
CHANGED
|
@@ -52,6 +52,7 @@ IMPERATIVES = {
|
|
|
52
52
|
"declare",
|
|
53
53
|
"decode",
|
|
54
54
|
"decorate",
|
|
55
|
+
"decrease",
|
|
55
56
|
"define",
|
|
56
57
|
"delegate",
|
|
57
58
|
"delete",
|
|
@@ -60,6 +61,7 @@ IMPERATIVES = {
|
|
|
60
61
|
"describe",
|
|
61
62
|
"detect",
|
|
62
63
|
"determine",
|
|
64
|
+
"disable",
|
|
63
65
|
"display",
|
|
64
66
|
"download",
|
|
65
67
|
"drop",
|
|
@@ -107,6 +109,8 @@ IMPERATIVES = {
|
|
|
107
109
|
"identify",
|
|
108
110
|
"implement",
|
|
109
111
|
"import",
|
|
112
|
+
"include",
|
|
113
|
+
"increase",
|
|
110
114
|
"indicate",
|
|
111
115
|
"init",
|
|
112
116
|
"initialise",
|
|
@@ -116,6 +120,7 @@ IMPERATIVES = {
|
|
|
116
120
|
"insert",
|
|
117
121
|
"instantiate",
|
|
118
122
|
"intercept",
|
|
123
|
+
"introduce",
|
|
119
124
|
"invoke",
|
|
120
125
|
"iterate",
|
|
121
126
|
"join",
|
|
@@ -126,6 +131,7 @@ IMPERATIVES = {
|
|
|
126
131
|
"load",
|
|
127
132
|
"log",
|
|
128
133
|
"look",
|
|
134
|
+
"lower",
|
|
129
135
|
"make",
|
|
130
136
|
"manage",
|
|
131
137
|
"manipulate",
|
|
@@ -141,7 +147,10 @@ IMPERATIVES = {
|
|
|
141
147
|
"note",
|
|
142
148
|
"obtain",
|
|
143
149
|
"open",
|
|
150
|
+
"optimize",
|
|
144
151
|
"output",
|
|
152
|
+
"organize",
|
|
153
|
+
"orchestrate",
|
|
145
154
|
"override",
|
|
146
155
|
"overwrite",
|
|
147
156
|
"package",
|
|
@@ -157,6 +166,7 @@ IMPERATIVES = {
|
|
|
157
166
|
"populate",
|
|
158
167
|
"post",
|
|
159
168
|
"prepare",
|
|
169
|
+
"prevent",
|
|
160
170
|
"print",
|
|
161
171
|
"process",
|
|
162
172
|
"produce",
|
|
@@ -169,6 +179,7 @@ IMPERATIVES = {
|
|
|
169
179
|
"read",
|
|
170
180
|
"record",
|
|
171
181
|
"redesign",
|
|
182
|
+
"refactor",
|
|
172
183
|
"refer",
|
|
173
184
|
"refresh",
|
|
174
185
|
"register",
|
|
@@ -187,6 +198,7 @@ IMPERATIVES = {
|
|
|
187
198
|
"retrieve",
|
|
188
199
|
"return",
|
|
189
200
|
"revert",
|
|
201
|
+
"rework",
|
|
190
202
|
"roll",
|
|
191
203
|
"rollback",
|
|
192
204
|
"round",
|
|
@@ -202,6 +214,7 @@ IMPERATIVES = {
|
|
|
202
214
|
"serve",
|
|
203
215
|
"set",
|
|
204
216
|
"show",
|
|
217
|
+
"simplify",
|
|
205
218
|
"simulate",
|
|
206
219
|
"source",
|
|
207
220
|
"specify",
|
|
@@ -230,6 +243,7 @@ IMPERATIVES = {
|
|
|
230
243
|
"try",
|
|
231
244
|
"turn",
|
|
232
245
|
"tweak",
|
|
246
|
+
"unify",
|
|
233
247
|
"update",
|
|
234
248
|
"upload",
|
|
235
249
|
"use",
|
commit_check/main.py
CHANGED
|
@@ -31,6 +31,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
31
31
|
parser = argparse.ArgumentParser(
|
|
32
32
|
prog="commit-check",
|
|
33
33
|
description="Check commit message, branch name, author name, email, and more.",
|
|
34
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
34
35
|
)
|
|
35
36
|
|
|
36
37
|
parser.add_argument(
|
|
@@ -47,14 +48,25 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
47
48
|
)
|
|
48
49
|
|
|
49
50
|
parser.add_argument(
|
|
51
|
+
"commit_msg_file",
|
|
52
|
+
nargs="?",
|
|
53
|
+
default=None,
|
|
54
|
+
help="path to commit message file (positional argument for pre-commit compatibility)",
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Main check type arguments
|
|
58
|
+
check_group = parser.add_argument_group(
|
|
59
|
+
"check types", "Specify which validation checks to run"
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
check_group.add_argument(
|
|
50
63
|
"-m",
|
|
51
64
|
"--message",
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
help="validate commit message. Optionally specify file path, otherwise reads from stdin if available",
|
|
65
|
+
action="store_true",
|
|
66
|
+
help="validate commit message (file path can be provided as positional argument for pre-commit compatibility)",
|
|
55
67
|
)
|
|
56
68
|
|
|
57
|
-
|
|
69
|
+
check_group.add_argument(
|
|
58
70
|
"-b",
|
|
59
71
|
"--branch",
|
|
60
72
|
help="check current git branch name",
|
|
@@ -62,7 +74,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
62
74
|
required=False,
|
|
63
75
|
)
|
|
64
76
|
|
|
65
|
-
|
|
77
|
+
check_group.add_argument(
|
|
66
78
|
"-n",
|
|
67
79
|
"--author-name",
|
|
68
80
|
help="check git author name",
|
|
@@ -70,7 +82,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
70
82
|
required=False,
|
|
71
83
|
)
|
|
72
84
|
|
|
73
|
-
|
|
85
|
+
check_group.add_argument(
|
|
74
86
|
"-e",
|
|
75
87
|
"--author-email",
|
|
76
88
|
help="check git author email",
|
|
@@ -78,7 +90,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
78
90
|
required=False,
|
|
79
91
|
)
|
|
80
92
|
|
|
81
|
-
|
|
93
|
+
check_group.add_argument(
|
|
82
94
|
"-d",
|
|
83
95
|
"--dry-run",
|
|
84
96
|
help="perform a dry run without failing (always returns 0)",
|
|
@@ -86,8 +98,12 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
86
98
|
required=False,
|
|
87
99
|
)
|
|
88
100
|
|
|
89
|
-
# Commit configuration options
|
|
90
|
-
parser.
|
|
101
|
+
# Commit message configuration options
|
|
102
|
+
commit_group = parser.add_argument_group(
|
|
103
|
+
"commit message options", "Configuration options for --message validation"
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
commit_group.add_argument(
|
|
91
107
|
"--conventional-commits",
|
|
92
108
|
type=parse_bool,
|
|
93
109
|
default=None,
|
|
@@ -95,7 +111,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
95
111
|
help="enforce conventional commits format (true/false)",
|
|
96
112
|
)
|
|
97
113
|
|
|
98
|
-
|
|
114
|
+
commit_group.add_argument(
|
|
99
115
|
"--subject-capitalized",
|
|
100
116
|
type=parse_bool,
|
|
101
117
|
default=None,
|
|
@@ -103,7 +119,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
103
119
|
help="require subject to start with capital letter (true/false)",
|
|
104
120
|
)
|
|
105
121
|
|
|
106
|
-
|
|
122
|
+
commit_group.add_argument(
|
|
107
123
|
"--subject-imperative",
|
|
108
124
|
type=parse_bool,
|
|
109
125
|
default=None,
|
|
@@ -111,7 +127,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
111
127
|
help="require subject to use imperative mood (true/false)",
|
|
112
128
|
)
|
|
113
129
|
|
|
114
|
-
|
|
130
|
+
commit_group.add_argument(
|
|
115
131
|
"--subject-max-length",
|
|
116
132
|
type=parse_int,
|
|
117
133
|
default=None,
|
|
@@ -119,7 +135,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
119
135
|
help="maximum length of commit subject",
|
|
120
136
|
)
|
|
121
137
|
|
|
122
|
-
|
|
138
|
+
commit_group.add_argument(
|
|
123
139
|
"--subject-min-length",
|
|
124
140
|
type=parse_int,
|
|
125
141
|
default=None,
|
|
@@ -127,7 +143,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
127
143
|
help="minimum length of commit subject",
|
|
128
144
|
)
|
|
129
145
|
|
|
130
|
-
|
|
146
|
+
commit_group.add_argument(
|
|
131
147
|
"--allow-commit-types",
|
|
132
148
|
type=parse_list,
|
|
133
149
|
default=None,
|
|
@@ -135,7 +151,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
135
151
|
help="comma-separated list of allowed commit types (e.g., feat,fix,docs)",
|
|
136
152
|
)
|
|
137
153
|
|
|
138
|
-
|
|
154
|
+
commit_group.add_argument(
|
|
139
155
|
"--allow-merge-commits",
|
|
140
156
|
type=parse_bool,
|
|
141
157
|
default=None,
|
|
@@ -143,7 +159,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
143
159
|
help="allow merge commits (true/false)",
|
|
144
160
|
)
|
|
145
161
|
|
|
146
|
-
|
|
162
|
+
commit_group.add_argument(
|
|
147
163
|
"--allow-revert-commits",
|
|
148
164
|
type=parse_bool,
|
|
149
165
|
default=None,
|
|
@@ -151,7 +167,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
151
167
|
help="allow revert commits (true/false)",
|
|
152
168
|
)
|
|
153
169
|
|
|
154
|
-
|
|
170
|
+
commit_group.add_argument(
|
|
155
171
|
"--allow-empty-commits",
|
|
156
172
|
type=parse_bool,
|
|
157
173
|
default=None,
|
|
@@ -159,7 +175,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
159
175
|
help="allow empty commit messages (true/false)",
|
|
160
176
|
)
|
|
161
177
|
|
|
162
|
-
|
|
178
|
+
commit_group.add_argument(
|
|
163
179
|
"--allow-fixup-commits",
|
|
164
180
|
type=parse_bool,
|
|
165
181
|
default=None,
|
|
@@ -167,7 +183,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
167
183
|
help="allow fixup commits (true/false)",
|
|
168
184
|
)
|
|
169
185
|
|
|
170
|
-
|
|
186
|
+
commit_group.add_argument(
|
|
171
187
|
"--allow-wip-commits",
|
|
172
188
|
type=parse_bool,
|
|
173
189
|
default=None,
|
|
@@ -175,7 +191,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
175
191
|
help="allow WIP commits (true/false)",
|
|
176
192
|
)
|
|
177
193
|
|
|
178
|
-
|
|
194
|
+
commit_group.add_argument(
|
|
179
195
|
"--require-body",
|
|
180
196
|
type=parse_bool,
|
|
181
197
|
default=None,
|
|
@@ -183,7 +199,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
183
199
|
help="require commit body (true/false)",
|
|
184
200
|
)
|
|
185
201
|
|
|
186
|
-
|
|
202
|
+
commit_group.add_argument(
|
|
187
203
|
"--require-signed-off-by",
|
|
188
204
|
type=parse_bool,
|
|
189
205
|
default=None,
|
|
@@ -191,7 +207,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
191
207
|
help="require 'Signed-off-by' trailer (true/false)",
|
|
192
208
|
)
|
|
193
209
|
|
|
194
|
-
|
|
210
|
+
commit_group.add_argument(
|
|
195
211
|
"--ignore-authors",
|
|
196
212
|
type=parse_list,
|
|
197
213
|
default=None,
|
|
@@ -200,7 +216,11 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
200
216
|
)
|
|
201
217
|
|
|
202
218
|
# Branch configuration options
|
|
203
|
-
parser.
|
|
219
|
+
branch_group = parser.add_argument_group(
|
|
220
|
+
"branch options", "Configuration options for --branch validation"
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
branch_group.add_argument(
|
|
204
224
|
"--conventional-branch",
|
|
205
225
|
type=parse_bool,
|
|
206
226
|
default=None,
|
|
@@ -208,7 +228,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
208
228
|
help="enforce conventional branch naming (true/false)",
|
|
209
229
|
)
|
|
210
230
|
|
|
211
|
-
|
|
231
|
+
branch_group.add_argument(
|
|
212
232
|
"--allow-branch-types",
|
|
213
233
|
type=parse_list,
|
|
214
234
|
default=None,
|
|
@@ -216,7 +236,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
216
236
|
help="comma-separated list of allowed branch types (e.g., feature,bugfix,hotfix)",
|
|
217
237
|
)
|
|
218
238
|
|
|
219
|
-
|
|
239
|
+
branch_group.add_argument(
|
|
220
240
|
"--allow-branch-names",
|
|
221
241
|
type=parse_list,
|
|
222
242
|
default=None,
|
|
@@ -224,7 +244,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
224
244
|
help="comma-separated list of additional allowed branch names",
|
|
225
245
|
)
|
|
226
246
|
|
|
227
|
-
|
|
247
|
+
branch_group.add_argument(
|
|
228
248
|
"--require-rebase-target",
|
|
229
249
|
type=str,
|
|
230
250
|
default=None,
|
|
@@ -232,7 +252,7 @@ def _get_parser() -> argparse.ArgumentParser:
|
|
|
232
252
|
help="target branch for rebase validation",
|
|
233
253
|
)
|
|
234
254
|
|
|
235
|
-
|
|
255
|
+
branch_group.add_argument(
|
|
236
256
|
"--branch-ignore-authors",
|
|
237
257
|
type=parse_list,
|
|
238
258
|
default=None,
|
|
@@ -296,11 +316,17 @@ def main() -> int:
|
|
|
296
316
|
rule_builder = RuleBuilder(config_data)
|
|
297
317
|
all_rules = rule_builder.build_all_rules()
|
|
298
318
|
|
|
319
|
+
# Handle positional commit_msg_file argument for pre-commit compatibility
|
|
320
|
+
# Store the file path separately from the boolean flag
|
|
321
|
+
commit_msg_file_path = None
|
|
322
|
+
if args.commit_msg_file:
|
|
323
|
+
commit_msg_file_path = args.commit_msg_file
|
|
324
|
+
# If a file was provided positionally, always enable message checking
|
|
325
|
+
args.message = True
|
|
326
|
+
|
|
299
327
|
# Filter rules based on CLI arguments
|
|
300
328
|
requested_checks = []
|
|
301
|
-
if
|
|
302
|
-
args.message is not None
|
|
303
|
-
): # Check for None explicitly since empty string is valid
|
|
329
|
+
if args.message: # args.message is now a boolean flag
|
|
304
330
|
# Add commit message related checks
|
|
305
331
|
requested_checks.extend(
|
|
306
332
|
[
|
|
@@ -340,18 +366,16 @@ def main() -> int:
|
|
|
340
366
|
stdin_content = None
|
|
341
367
|
commit_file_path = None
|
|
342
368
|
|
|
343
|
-
if
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
369
|
+
if args.message: # args.message is a boolean flag
|
|
370
|
+
# Check if we have a file path from positional argument
|
|
371
|
+
if commit_msg_file_path:
|
|
372
|
+
commit_file_path = commit_msg_file_path
|
|
373
|
+
else:
|
|
374
|
+
# No file path provided, try reading from stdin
|
|
348
375
|
stdin_content = stdin_reader.read_piped_input()
|
|
349
376
|
if not stdin_content:
|
|
350
377
|
# No stdin and no file - let validators get data from git themselves
|
|
351
378
|
stdin_content = None
|
|
352
|
-
else:
|
|
353
|
-
# Message is a file path
|
|
354
|
-
commit_file_path = args.message
|
|
355
379
|
elif not any([args.branch, args.author_name, args.author_email]):
|
|
356
380
|
# If no specific validation type is requested, don't read stdin
|
|
357
381
|
pass
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: commit-check
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.2
|
|
4
4
|
Summary: Check commit message formatting, branch naming, commit author, email, and more.
|
|
5
5
|
Author-email: Xianpeng Shen <xianpeng.shen@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -149,7 +149,7 @@ For one-off checks or CI/CD pipelines, you can configure via CLI arguments or en
|
|
|
149
149
|
- repo: https://github.com/commit-check/commit-check
|
|
150
150
|
rev: v2.3.0
|
|
151
151
|
hooks:
|
|
152
|
-
- id:
|
|
152
|
+
- id: check-message
|
|
153
153
|
args:
|
|
154
154
|
- --subject-imperative=false
|
|
155
155
|
- --subject-max-length=100
|
|
@@ -2,14 +2,14 @@ commit_check/__init__.py,sha256=6bUw-6fUjCN5qAxe6i4mUztQiAHpjOhyPHsegW1tbBc,1297
|
|
|
2
2
|
commit_check/config.py,sha256=88zOLW6W2DHQjglxfSR3LQhCXgw-QcfEg118-OaWxIg,1031
|
|
3
3
|
commit_check/config_merger.py,sha256=QwOLi3-pm-1w77aMiBeJzJLKoERDJlzH4IfTyNa421I,9427
|
|
4
4
|
commit_check/engine.py,sha256=O9H39JgqrzWclfVTZYf-tJP8lAhHzGfV7j-CIxAsXWA,19348
|
|
5
|
-
commit_check/imperatives.py,sha256=
|
|
6
|
-
commit_check/main.py,sha256=
|
|
5
|
+
commit_check/imperatives.py,sha256=dNLeGUaSjfWtKNcFnmMWWmzcfX5J2sTCWZcOmEKlbm4,3829
|
|
6
|
+
commit_check/main.py,sha256=Ozm-ZJcIo-sjuXA7NZtEQCxP9PzKsKN9yP0_puIBs8Y,12094
|
|
7
7
|
commit_check/rule_builder.py,sha256=0UqMQxDiPNgqEjmRTYnyHimCA7vZRZqgqdm7ughp3DY,9205
|
|
8
8
|
commit_check/rules_catalog.py,sha256=FSRsdecwfUteEp3J8lnfehLu4j6owZlWfDzPa1ar1Fg,4288
|
|
9
9
|
commit_check/util.py,sha256=4c9cxbBR3ZBSmYGNmzj87XWWr0zsCV8tmg1Z1yZ3iBI,8501
|
|
10
|
-
commit_check-2.4.
|
|
11
|
-
commit_check-2.4.
|
|
12
|
-
commit_check-2.4.
|
|
13
|
-
commit_check-2.4.
|
|
14
|
-
commit_check-2.4.
|
|
15
|
-
commit_check-2.4.
|
|
10
|
+
commit_check-2.4.2.dist-info/licenses/LICENSE,sha256=VAJ9TE1ov8aUKmeoBRYqciMs0CXag1TeDCoLhwbeQmA,1095
|
|
11
|
+
commit_check-2.4.2.dist-info/METADATA,sha256=h7-PAMqvqWCSMgSCvaz8aCRlom8fp2bs4feYStJhoAY,10724
|
|
12
|
+
commit_check-2.4.2.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
|
|
13
|
+
commit_check-2.4.2.dist-info/entry_points.txt,sha256=YMrkFGeub-3-IanV1d9qnopXVaRQM7MA9foXKW9iZ88,86
|
|
14
|
+
commit_check-2.4.2.dist-info/top_level.txt,sha256=Wf46u-ooHBMJNHbhfrBNQw3wC5_m8wt-o_Lfbc4QpRg,13
|
|
15
|
+
commit_check-2.4.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|