You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -43,10 +43,10 @@ Each component is checked for compliance with the provided or default configurat
43
43
44
44
If your commit message does not meet the required format, the hook will fail, producing a **report that shows which part of your commit message needs correction**:
The hint message suggests that you can preserve your original message and simply edit it in your default editor, without the need to type the whole message again.
52
52
@@ -109,6 +109,7 @@ The linter accepts several configurable parameters to tailor commit message vali
109
109
110
110
- `--types`: Define the types of commits allowed (default: [`change`, `ci`, `docs`, `feat`, `fix`, `refactor`, `remove`, `revert`, `test`]).
111
111
- `--scopes`: Specifies a list of allowed scopes. If not defined, all scopes are allowed (restriction is `disabled`).
112
+
- `--scope-case-insensitive`: Allows uppercase letters in scope.
112
113
- `--subject-min-length`: Set the minimum length for the summary (default: `20`).
113
114
- `--subject-max-length`: Set the maximum length for the summary (default: `72`).
114
115
- `--body-max-line-length`: Set the maximum line length for the body (default: `100`).
f"{_get_icon_for_rule(rules_output_status['error_scope_format'])}{_color_blue('(<optional-scope>)')} if used, must be enclosed in parentheses"
173
176
)
174
-
rule_messages.append(
175
-
f"{_get_icon_for_rule(rules_output_status['error_scope_capitalization'])}{_color_blue('(<optional-scope>)')} if used, must be written in lower case without whitespace"
176
-
)
177
+
178
+
ifargs.scope_case_insensitive:
179
+
rule_messages.append(
180
+
f"{_get_icon_for_rule(rules_output_status['error_scope_capitalization'])}{_color_blue('(<optional-scope>)')} if used, must not contain whitespace"
181
+
)
182
+
else:
183
+
rule_messages.append(
184
+
f"{_get_icon_for_rule(rules_output_status['error_scope_capitalization'])}{_color_blue('(<optional-scope>)')} if used, must be written in lower case without whitespace"
185
+
)
177
186
ifargs.scopes:
178
187
rule_messages.append(
179
188
f"{_get_icon_for_rule(rules_output_status['error_scope_allowed'])}{_color_blue('(<optional-scope>)')} if used, must be one of the following allowed scopes: [{_color_blue(', '.join(args.scopes))}]"
180
189
)
181
190
182
191
# SUMMARY messages
183
-
rule_messages.append(f"{_get_icon_for_rule(rules_output_status['error_summary_period'])}{_color_orange('<summary>')} must not end with a period")
192
+
rule_messages.append(f"{_get_icon_for_rule(rules_output_status['error_summary_period'])}{_color_orange('<summary>')} must not end with a period '.'")
184
193
rule_messages.append(
185
194
f"{_get_icon_for_rule(rules_output_status['error_summary_length'])}{_color_orange('<summary>')} must be between {args.subject_min_length} and {args.subject_max_length} characters long"
'feat(bootloader): This is commit message with scope and body\n\nThis is a text of body',
26
52
{},
53
+
get_argv_list(),
27
54
),
28
55
(
29
56
# Expected PASS: Message with scope, without body
30
57
'change(wifi): This is commit message with scope without body',
31
58
{},
59
+
get_argv_list(),
32
60
),
33
61
(
34
62
# Expected PASS: Message with scope (with hyphen in scope), without body
35
63
'change(esp-rom): This is commit message with hyphen in scope',
36
64
{},
65
+
get_argv_list(),
37
66
),
38
67
(
39
68
# Expected PASS: Message with scope (with asterisk in scope), without body
40
69
'change(examples*storage): This is commit message with asterisk in scope',
41
70
{},
71
+
get_argv_list(),
42
72
),
43
73
(
44
74
# Expected FAIL: Message with not allowed scope and body
45
75
'feat(tomas): This is commit message with scope and body\n\nThis is a text of body',
46
76
{'error_scope_allowed': True},
77
+
get_argv_list(),
47
78
),
48
79
(
49
80
# Expected FAIL: Message with scope (with comma in scope), without body
50
81
'change(examples,storage): This is commit message with comma in scope',
51
82
{'error_scope_allowed': True},
83
+
get_argv_list(),
52
84
),
53
85
(
54
86
# Expected PASS: Message with scope (with slash in scope), without body
55
87
'change(examples/storage): This is commit message with slash in scope',
56
88
{'error_scope_allowed': True},
89
+
get_argv_list(),
57
90
),
58
91
(
59
92
# Expected PASS: Message without scope, with body
60
93
"change: This is commit message without scope with body\n\nThis is a text of body\n# Please enter the commit message for your changes. Lines starting\n# with '#' will be ignored, and an empty message aborts the commit.\n#",
61
94
{},
95
+
get_argv_list(),
62
96
),
63
97
(
64
98
# Expected PASS: Message without scope, without body
65
99
'change: This is commit message without scope and body',
66
100
{},
101
+
get_argv_list(),
67
102
),
68
103
(
69
104
# Expected PASS: Test of additional types
70
105
'fox(esp32): Testing additional types\n\nThis is a text of body',
71
106
{},
107
+
get_argv_list(),
72
108
),
73
109
(
74
110
# Expected PASS: 'body' line longer (custom arg 107 chars)
75
111
'fix(bt): Update database schemas\n\nUpdating the database schema to include fields and user profile preferences, cleaning up unnecessary calls',
76
112
{},
113
+
get_argv_list(),
77
114
),
78
115
(
79
116
# Expected PASS: Message without scope with exclamation mark
80
117
'change!: This is commit with exclamation mark',
81
118
{},
119
+
get_argv_list(),
82
120
),
83
121
(
84
122
# Expected PASS: Message with scope with exclamation mark
85
123
'change(rom)!: This is commit with exclamation mark',
86
124
{},
125
+
get_argv_list(),
87
126
),
88
127
(
89
128
# Expected FAIL: Message with scope with 2 exclamation marks
90
129
'change(rom)!!: This is commit message with 2 exclamations',
91
130
{'error_type': True},
131
+
get_argv_list(),
92
132
),
93
133
(
94
134
# Expected FAIL: missing colon between 'type' (and 'scope') and 'summary'
95
135
'change this is commit message without body',
96
136
{'missing_colon': True},
137
+
get_argv_list(),
97
138
),
98
139
(
99
140
# Expected FAIL: empty commit message
100
141
' \n\n\n',
101
142
{'empty_message': True},
143
+
get_argv_list(),
102
144
),
103
145
(
104
146
# Expected FAIL: 'summary' too short
105
147
'fix: Fix bug',
106
148
{'error_summary_length': True},
149
+
get_argv_list(),
107
150
),
108
151
(
109
152
# Expected FAIL: 'summary' too long
110
153
'change(rom): Refactor authentication flow for enhanced security measures',
111
154
{'error_summary_length': True},
155
+
get_argv_list(),
112
156
),
113
157
(
114
158
# Expected FAIL: 'summary' ends with period
115
159
'change(rom): Fixed the another bug.',
116
160
{'error_summary_period': True},
161
+
get_argv_list(),
117
162
),
118
163
(
119
164
# Expected FAIL: 'summary' starts with lowercase
120
165
'change(rom): this message starts with lowercase',
121
166
{'error_summary_capitalization': True},
122
-
),
123
-
(
124
-
# Expected FAIL: uppercase in 'scope', with body
125
-
'change(Bt): Added new feature with change\n\nThis feature adds functionality',
0 commit comments