commitfmt 0.4.0__tar.gz → 1.0.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commitfmt
3
- Version: 0.4.0
3
+ Version: 1.0.0
4
4
  Summary: Utility for formatting and verifying the commit message.
5
5
  Author-email: Mikhael Khrustik <misha@myrt.co>
6
6
  License: MIT
@@ -178,13 +178,13 @@ Most of the linting rules are disabled by default. Default config contains 2 rul
178
178
 
179
179
  ```toml
180
180
  [lint.header]
181
- full-stop = true
181
+ description-full-stop = true
182
182
 
183
183
  [lint.footer]
184
184
  breaking-exclamation = true
185
185
  ```
186
186
 
187
- To enable more rules, create a `commitfmt.toml` or (`.commitfmt.toml`) file in the root of your project. Available lint rules can be found in the [rules.md](https://github.com/mishamyrt/commitfmt/blob/main/crates/commitfmt_linter/docs/rules.md) file.
187
+ To enable more rules, create a `commitfmt.toml` or (`.commitfmt.toml`) file in the root of your project. Available lint rules can be found in the [rules.md](https://github.com/mishamyrt/commitfmt/blob/main/crates/commitfmt-linter/docs/rules.md) file.
188
188
 
189
189
  If there is a problem with an enabled rule and it cannot be automatically fixed, the commit process will be aborted.
190
190
 
@@ -237,26 +237,37 @@ Lines starting with the comment symbol will be ignored during parsing.
237
237
 
238
238
  commitfmt can add additional footers to the commit message.
239
239
 
240
- #### Value template
240
+ #### Static value
241
241
 
242
- You can use a template to format the value of the footer. Inside of template expression you can use any shell command available at the `PATH`.
242
+ You can add a footer with a static value:
243
243
 
244
- For example, to add the `Authored-By` footer with the current user name, add the following to your config file:
244
+ ```toml
245
+ [[additional-footers]]
246
+ key = "Authored-By"
247
+ value = "John Doe"
248
+ ```
249
+
250
+ #### Shell commands
251
+
252
+ You can use shell commands to dynamically generate footer values:
245
253
 
246
254
  ```toml
247
- [additional-footers]
255
+ [[additional-footers]]
248
256
  key = "Authored-By"
249
- value-template = "{{ echo $USER }}"
257
+ value = "{{ echo $USER }}"
250
258
  ```
251
259
 
260
+ Inside the template expression you can use any shell command available in the `PATH`.
261
+
252
262
  #### Branch value pattern
253
263
 
254
264
  You can also add the ticket number from the task tracker to the footer if it is in the branch name:
255
265
 
256
266
  ```toml
257
- [additional-footers]
267
+ [[additional-footers]]
258
268
  key = "Ticket-ID"
259
- branch-value-pattern = "(?:.*)/([A-Z0-9-]+)/?(?:.*)"
269
+ branch-pattern = "(?:.*)/(?<TICKET_ID>[A-Z0-9-]+)/?(?:.*)"
270
+ value = "${{ TICKET_ID }}"
260
271
  ```
261
272
 
262
273
  For example, if your branch name is `feature/CC-123/add-new-feature` or `feature/CC-123`, the `Ticket-ID` footer will be added to the commit message with the value `CC-123`.
@@ -265,27 +276,27 @@ If the ticket number is not found in the branch name, footer will be skipped.
265
276
 
266
277
  You can use [rustexp](https://rustexp.lpil.uk) to test your pattern.
267
278
 
268
- ##### Recipes
279
+ ##### Patterns
269
280
 
270
281
  Examples of patterns for branch names in git flow format:
271
282
 
272
- - Jira/YouTrack: `(?:.*)/([A-Z0-9-]+)/?(?:.*)`
283
+ - Jira/YouTrack: `(?:.*)/(?<TICKET_ID>[A-Z0-9-]+)/?(?:.*)`
273
284
  - `feature/CFMT-123`
274
285
  - `feature/CFMT-123/add-new-feature`
275
- - GitHub: `(?:.*)/#?([0-9-]+)/?(?:.*)`
276
- - `feature/#123`
286
+ - GitHub: `(?:.*)/(?<ISSUE_ID>[0-9-]+)/?(?:.*)`
277
287
  - `feature/123`
278
- - `feature/#123/add-new-feature`
288
+ - `feature/123/add-new-feature`
279
289
 
280
290
  #### On conflict
281
291
 
282
292
  If the footer already exists in the commit message, you can specify what to do with it. By default, the footer will be skipped.
283
293
 
284
294
  ```toml
285
- [additional-footers]
295
+ [[additional-footers]]
286
296
  key = "Ticket-ID"
287
- branch-value-pattern = "(?:.*)/([A-Z0-9-]+)/?(?:.*)"
288
- on-conflict = "skip" # skip, append, error
297
+ branch-pattern = "(?:.*)/(?<TICKET_ID>[A-Z0-9-]+)/?(?:.*)"
298
+ value = "${{ TICKET_ID }}"
299
+ on-conflict = "error" # optional. default: skip. available: skip, append, error
289
300
  ```
290
301
 
291
302
  Available options:
@@ -294,6 +305,44 @@ Available options:
294
305
  - `append` - append the footer to the end of the footer list
295
306
  - `error` - abort the commit
296
307
 
308
+ #### Footer formatting
309
+
310
+ You can customize how footers are formatted using `separator` and `alignment` options:
311
+
312
+ ```toml
313
+ [[additional-footers]]
314
+ key = "Ticket-ID"
315
+ value = "CFMT-123"
316
+ separator = "#"
317
+ alignment = "right"
318
+ ```
319
+
320
+ Available alignment options:
321
+
322
+ - `left` - align separator to the left (default)
323
+ - `right` - align separator to the right
324
+
325
+ ### Recipe
326
+
327
+ To enforce conventional commits, you can use the following configuration:
328
+
329
+ ```toml
330
+ [lint.header]
331
+ type-enum = ["chore", "ci", "feat", "fix", "refactor", "style", "test", "docs"]
332
+ description-case = "lower-first"
333
+ description-max-length = 72
334
+ description-full-stop = true
335
+ type-required = true
336
+ # scope-enum = ["cc", "config", "git", "linter"] # optional
337
+
338
+ [lint.body]
339
+ max-line-length = 72
340
+ case = "upper-first"
341
+
342
+ [lint.footer]
343
+ breaking-exclamation = true
344
+ ```
345
+
297
346
  ## Testing
298
347
 
299
348
  To test the configuration and the work of commitfmt, run the following command:
@@ -155,13 +155,13 @@ Most of the linting rules are disabled by default. Default config contains 2 rul
155
155
 
156
156
  ```toml
157
157
  [lint.header]
158
- full-stop = true
158
+ description-full-stop = true
159
159
 
160
160
  [lint.footer]
161
161
  breaking-exclamation = true
162
162
  ```
163
163
 
164
- To enable more rules, create a `commitfmt.toml` or (`.commitfmt.toml`) file in the root of your project. Available lint rules can be found in the [rules.md](https://github.com/mishamyrt/commitfmt/blob/main/crates/commitfmt_linter/docs/rules.md) file.
164
+ To enable more rules, create a `commitfmt.toml` or (`.commitfmt.toml`) file in the root of your project. Available lint rules can be found in the [rules.md](https://github.com/mishamyrt/commitfmt/blob/main/crates/commitfmt-linter/docs/rules.md) file.
165
165
 
166
166
  If there is a problem with an enabled rule and it cannot be automatically fixed, the commit process will be aborted.
167
167
 
@@ -214,26 +214,37 @@ Lines starting with the comment symbol will be ignored during parsing.
214
214
 
215
215
  commitfmt can add additional footers to the commit message.
216
216
 
217
- #### Value template
217
+ #### Static value
218
218
 
219
- You can use a template to format the value of the footer. Inside of template expression you can use any shell command available at the `PATH`.
219
+ You can add a footer with a static value:
220
220
 
221
- For example, to add the `Authored-By` footer with the current user name, add the following to your config file:
221
+ ```toml
222
+ [[additional-footers]]
223
+ key = "Authored-By"
224
+ value = "John Doe"
225
+ ```
226
+
227
+ #### Shell commands
228
+
229
+ You can use shell commands to dynamically generate footer values:
222
230
 
223
231
  ```toml
224
- [additional-footers]
232
+ [[additional-footers]]
225
233
  key = "Authored-By"
226
- value-template = "{{ echo $USER }}"
234
+ value = "{{ echo $USER }}"
227
235
  ```
228
236
 
237
+ Inside the template expression you can use any shell command available in the `PATH`.
238
+
229
239
  #### Branch value pattern
230
240
 
231
241
  You can also add the ticket number from the task tracker to the footer if it is in the branch name:
232
242
 
233
243
  ```toml
234
- [additional-footers]
244
+ [[additional-footers]]
235
245
  key = "Ticket-ID"
236
- branch-value-pattern = "(?:.*)/([A-Z0-9-]+)/?(?:.*)"
246
+ branch-pattern = "(?:.*)/(?<TICKET_ID>[A-Z0-9-]+)/?(?:.*)"
247
+ value = "${{ TICKET_ID }}"
237
248
  ```
238
249
 
239
250
  For example, if your branch name is `feature/CC-123/add-new-feature` or `feature/CC-123`, the `Ticket-ID` footer will be added to the commit message with the value `CC-123`.
@@ -242,27 +253,27 @@ If the ticket number is not found in the branch name, footer will be skipped.
242
253
 
243
254
  You can use [rustexp](https://rustexp.lpil.uk) to test your pattern.
244
255
 
245
- ##### Recipes
256
+ ##### Patterns
246
257
 
247
258
  Examples of patterns for branch names in git flow format:
248
259
 
249
- - Jira/YouTrack: `(?:.*)/([A-Z0-9-]+)/?(?:.*)`
260
+ - Jira/YouTrack: `(?:.*)/(?<TICKET_ID>[A-Z0-9-]+)/?(?:.*)`
250
261
  - `feature/CFMT-123`
251
262
  - `feature/CFMT-123/add-new-feature`
252
- - GitHub: `(?:.*)/#?([0-9-]+)/?(?:.*)`
253
- - `feature/#123`
263
+ - GitHub: `(?:.*)/(?<ISSUE_ID>[0-9-]+)/?(?:.*)`
254
264
  - `feature/123`
255
- - `feature/#123/add-new-feature`
265
+ - `feature/123/add-new-feature`
256
266
 
257
267
  #### On conflict
258
268
 
259
269
  If the footer already exists in the commit message, you can specify what to do with it. By default, the footer will be skipped.
260
270
 
261
271
  ```toml
262
- [additional-footers]
272
+ [[additional-footers]]
263
273
  key = "Ticket-ID"
264
- branch-value-pattern = "(?:.*)/([A-Z0-9-]+)/?(?:.*)"
265
- on-conflict = "skip" # skip, append, error
274
+ branch-pattern = "(?:.*)/(?<TICKET_ID>[A-Z0-9-]+)/?(?:.*)"
275
+ value = "${{ TICKET_ID }}"
276
+ on-conflict = "error" # optional. default: skip. available: skip, append, error
266
277
  ```
267
278
 
268
279
  Available options:
@@ -271,6 +282,44 @@ Available options:
271
282
  - `append` - append the footer to the end of the footer list
272
283
  - `error` - abort the commit
273
284
 
285
+ #### Footer formatting
286
+
287
+ You can customize how footers are formatted using `separator` and `alignment` options:
288
+
289
+ ```toml
290
+ [[additional-footers]]
291
+ key = "Ticket-ID"
292
+ value = "CFMT-123"
293
+ separator = "#"
294
+ alignment = "right"
295
+ ```
296
+
297
+ Available alignment options:
298
+
299
+ - `left` - align separator to the left (default)
300
+ - `right` - align separator to the right
301
+
302
+ ### Recipe
303
+
304
+ To enforce conventional commits, you can use the following configuration:
305
+
306
+ ```toml
307
+ [lint.header]
308
+ type-enum = ["chore", "ci", "feat", "fix", "refactor", "style", "test", "docs"]
309
+ description-case = "lower-first"
310
+ description-max-length = 72
311
+ description-full-stop = true
312
+ type-required = true
313
+ # scope-enum = ["cc", "config", "git", "linter"] # optional
314
+
315
+ [lint.body]
316
+ max-line-length = 72
317
+ case = "upper-first"
318
+
319
+ [lint.footer]
320
+ breaking-exclamation = true
321
+ ```
322
+
274
323
  ## Testing
275
324
 
276
325
  To test the configuration and the work of commitfmt, run the following command:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commitfmt
3
- Version: 0.4.0
3
+ Version: 1.0.0
4
4
  Summary: Utility for formatting and verifying the commit message.
5
5
  Author-email: Mikhael Khrustik <misha@myrt.co>
6
6
  License: MIT
@@ -178,13 +178,13 @@ Most of the linting rules are disabled by default. Default config contains 2 rul
178
178
 
179
179
  ```toml
180
180
  [lint.header]
181
- full-stop = true
181
+ description-full-stop = true
182
182
 
183
183
  [lint.footer]
184
184
  breaking-exclamation = true
185
185
  ```
186
186
 
187
- To enable more rules, create a `commitfmt.toml` or (`.commitfmt.toml`) file in the root of your project. Available lint rules can be found in the [rules.md](https://github.com/mishamyrt/commitfmt/blob/main/crates/commitfmt_linter/docs/rules.md) file.
187
+ To enable more rules, create a `commitfmt.toml` or (`.commitfmt.toml`) file in the root of your project. Available lint rules can be found in the [rules.md](https://github.com/mishamyrt/commitfmt/blob/main/crates/commitfmt-linter/docs/rules.md) file.
188
188
 
189
189
  If there is a problem with an enabled rule and it cannot be automatically fixed, the commit process will be aborted.
190
190
 
@@ -237,26 +237,37 @@ Lines starting with the comment symbol will be ignored during parsing.
237
237
 
238
238
  commitfmt can add additional footers to the commit message.
239
239
 
240
- #### Value template
240
+ #### Static value
241
241
 
242
- You can use a template to format the value of the footer. Inside of template expression you can use any shell command available at the `PATH`.
242
+ You can add a footer with a static value:
243
243
 
244
- For example, to add the `Authored-By` footer with the current user name, add the following to your config file:
244
+ ```toml
245
+ [[additional-footers]]
246
+ key = "Authored-By"
247
+ value = "John Doe"
248
+ ```
249
+
250
+ #### Shell commands
251
+
252
+ You can use shell commands to dynamically generate footer values:
245
253
 
246
254
  ```toml
247
- [additional-footers]
255
+ [[additional-footers]]
248
256
  key = "Authored-By"
249
- value-template = "{{ echo $USER }}"
257
+ value = "{{ echo $USER }}"
250
258
  ```
251
259
 
260
+ Inside the template expression you can use any shell command available in the `PATH`.
261
+
252
262
  #### Branch value pattern
253
263
 
254
264
  You can also add the ticket number from the task tracker to the footer if it is in the branch name:
255
265
 
256
266
  ```toml
257
- [additional-footers]
267
+ [[additional-footers]]
258
268
  key = "Ticket-ID"
259
- branch-value-pattern = "(?:.*)/([A-Z0-9-]+)/?(?:.*)"
269
+ branch-pattern = "(?:.*)/(?<TICKET_ID>[A-Z0-9-]+)/?(?:.*)"
270
+ value = "${{ TICKET_ID }}"
260
271
  ```
261
272
 
262
273
  For example, if your branch name is `feature/CC-123/add-new-feature` or `feature/CC-123`, the `Ticket-ID` footer will be added to the commit message with the value `CC-123`.
@@ -265,27 +276,27 @@ If the ticket number is not found in the branch name, footer will be skipped.
265
276
 
266
277
  You can use [rustexp](https://rustexp.lpil.uk) to test your pattern.
267
278
 
268
- ##### Recipes
279
+ ##### Patterns
269
280
 
270
281
  Examples of patterns for branch names in git flow format:
271
282
 
272
- - Jira/YouTrack: `(?:.*)/([A-Z0-9-]+)/?(?:.*)`
283
+ - Jira/YouTrack: `(?:.*)/(?<TICKET_ID>[A-Z0-9-]+)/?(?:.*)`
273
284
  - `feature/CFMT-123`
274
285
  - `feature/CFMT-123/add-new-feature`
275
- - GitHub: `(?:.*)/#?([0-9-]+)/?(?:.*)`
276
- - `feature/#123`
286
+ - GitHub: `(?:.*)/(?<ISSUE_ID>[0-9-]+)/?(?:.*)`
277
287
  - `feature/123`
278
- - `feature/#123/add-new-feature`
288
+ - `feature/123/add-new-feature`
279
289
 
280
290
  #### On conflict
281
291
 
282
292
  If the footer already exists in the commit message, you can specify what to do with it. By default, the footer will be skipped.
283
293
 
284
294
  ```toml
285
- [additional-footers]
295
+ [[additional-footers]]
286
296
  key = "Ticket-ID"
287
- branch-value-pattern = "(?:.*)/([A-Z0-9-]+)/?(?:.*)"
288
- on-conflict = "skip" # skip, append, error
297
+ branch-pattern = "(?:.*)/(?<TICKET_ID>[A-Z0-9-]+)/?(?:.*)"
298
+ value = "${{ TICKET_ID }}"
299
+ on-conflict = "error" # optional. default: skip. available: skip, append, error
289
300
  ```
290
301
 
291
302
  Available options:
@@ -294,6 +305,44 @@ Available options:
294
305
  - `append` - append the footer to the end of the footer list
295
306
  - `error` - abort the commit
296
307
 
308
+ #### Footer formatting
309
+
310
+ You can customize how footers are formatted using `separator` and `alignment` options:
311
+
312
+ ```toml
313
+ [[additional-footers]]
314
+ key = "Ticket-ID"
315
+ value = "CFMT-123"
316
+ separator = "#"
317
+ alignment = "right"
318
+ ```
319
+
320
+ Available alignment options:
321
+
322
+ - `left` - align separator to the left (default)
323
+ - `right` - align separator to the right
324
+
325
+ ### Recipe
326
+
327
+ To enforce conventional commits, you can use the following configuration:
328
+
329
+ ```toml
330
+ [lint.header]
331
+ type-enum = ["chore", "ci", "feat", "fix", "refactor", "style", "test", "docs"]
332
+ description-case = "lower-first"
333
+ description-max-length = 72
334
+ description-full-stop = true
335
+ type-required = true
336
+ # scope-enum = ["cc", "config", "git", "linter"] # optional
337
+
338
+ [lint.body]
339
+ max-line-length = 72
340
+ case = "upper-first"
341
+
342
+ [lint.footer]
343
+ breaking-exclamation = true
344
+ ```
345
+
297
346
  ## Testing
298
347
 
299
348
  To test the configuration and the work of commitfmt, run the following command:
@@ -4,7 +4,7 @@ authors = [
4
4
  {name = "Mikhael Khrustik", email = "misha@myrt.co"},
5
5
  ]
6
6
  description = "Utility for formatting and verifying the commit message."
7
- version = "0.4.0"
7
+ version = "1.0.0"
8
8
  readme = "README.md"
9
9
  requires-python = ">=3.9"
10
10
  keywords = ["git", "hook"]
File without changes