commitfmt 0.4.0__py3-none-any.whl → 1.0.0__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.
@@ -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:
@@ -0,0 +1,8 @@
1
+ commitfmt/__init__.py,sha256=XbqA09CGurplp5_c9PpHKvYDGevnhBjtUoYClkU9TCU,32
2
+ commitfmt/__main__.py,sha256=oYv9CGhyxv4OJDAo8jY-vH3WZ9y6IBt9FAVMIDdGARs,353
3
+ commitfmt/commitfmt.py,sha256=4D-ifjc3kqn_wGGZCUFgp5HKGZ5UmU6qnJahwx7HopI,995
4
+ commitfmt-1.0.0.dist-info/METADATA,sha256=EggCq9F1yGX-7MWWxP_jTBrHh0hOs2N5UVtp8u3BCgs,10182
5
+ commitfmt-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ commitfmt-1.0.0.dist-info/entry_points.txt,sha256=WbaxVY_kl8rYTrC2jtjP0U5x6gB0Q6CF5V2YKMrXQfc,54
7
+ commitfmt-1.0.0.dist-info/top_level.txt,sha256=YDzuLgcXgStEzOmg2c7IQZIpsye34U2vKCIheKEvyjg,10
8
+ commitfmt-1.0.0.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- commitfmt/__init__.py,sha256=XbqA09CGurplp5_c9PpHKvYDGevnhBjtUoYClkU9TCU,32
2
- commitfmt/__main__.py,sha256=oYv9CGhyxv4OJDAo8jY-vH3WZ9y6IBt9FAVMIDdGARs,353
3
- commitfmt/commitfmt.py,sha256=4D-ifjc3kqn_wGGZCUFgp5HKGZ5UmU6qnJahwx7HopI,995
4
- commitfmt-0.4.0.dist-info/METADATA,sha256=DR0nMBkLVtxvla9gphzG1Y_viW1VdqufMG89GOe0h44,9229
5
- commitfmt-0.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- commitfmt-0.4.0.dist-info/entry_points.txt,sha256=WbaxVY_kl8rYTrC2jtjP0U5x6gB0Q6CF5V2YKMrXQfc,54
7
- commitfmt-0.4.0.dist-info/top_level.txt,sha256=YDzuLgcXgStEzOmg2c7IQZIpsye34U2vKCIheKEvyjg,10
8
- commitfmt-0.4.0.dist-info/RECORD,,