Wrap message body at 72 caracters (and limit subject to 50) #5

Closed
opened 2025-07-06 15:44:41 +00:00 by glenux · 1 comment
Owner

Note: Copy of issue from upstream project: https://github.com/GNtousakis/llm-commit/issues/12


Introduce an automatic formatting step in llm-commit to ensure that generated commit messages adhere to common best practices regarding line lengths, particularly:

  • Subject line ≤ 50 characters
  • Body lines wrapped at 72 characters
    This behavior should be enabled by default.

Problem

Currently, llm-commit may generate well-structured commit messages, but it doesn't guarantee adherence to formatting conventions regarding line lengths. For instance:

Current output example:

chore(makefile): enhance CSS build output readability

Improved the readability of the generated CSS files by expanding their style format. This change aids in debugging and maintenance by providing a clearer view of the CSS structure.

* Added `--style=expanded` option to the `npx sass` command in the Makefile
* Ensures that the generated CSS is more human-readable, facilitating easier troubleshooting and updates

This leads to long, hard-to-read lines, especially in terminal-based workflows.

A correct formatting should give :

chore(makefile): enhance CSS build output readability

Improved the readability of the generated CSS files by expanding their
style format. This change aids in debugging and maintenance by providing
a clearer view of the CSS structure.

* Added `--style=expanded` option to the `npx sass` command in the
  Makefile
* Ensures that the generated CSS is more human-readable, facilitating
  easier troubleshooting and updates

Proposed solution

  1. Add a default post-processing step to format the commit message body:
    • Wrap body lines at 72 characters.
    • Optionally warn if the subject line exceeds 50 characters.
  2. Use the mdformat library to perform Markdown-aware formatting, preserving lists and code blocks.

References

Note: Copy of issue from upstream project: https://github.com/GNtousakis/llm-commit/issues/12 --- Introduce an automatic formatting step in `llm-commit` to ensure that generated commit messages adhere to common best practices regarding line lengths, particularly: - Subject line ≤ 50 characters - Body lines wrapped at 72 characters This behavior should be **enabled by default**. ## Problem Currently, `llm-commit` may generate well-structured commit messages, but it doesn't guarantee adherence to formatting conventions regarding line lengths. For instance: **Current output example:** ``` chore(makefile): enhance CSS build output readability Improved the readability of the generated CSS files by expanding their style format. This change aids in debugging and maintenance by providing a clearer view of the CSS structure. * Added `--style=expanded` option to the `npx sass` command in the Makefile * Ensures that the generated CSS is more human-readable, facilitating easier troubleshooting and updates ``` This leads to long, hard-to-read lines, especially in terminal-based workflows. A correct formatting should give : ``` chore(makefile): enhance CSS build output readability Improved the readability of the generated CSS files by expanding their style format. This change aids in debugging and maintenance by providing a clearer view of the CSS structure. * Added `--style=expanded` option to the `npx sass` command in the Makefile * Ensures that the generated CSS is more human-readable, facilitating easier troubleshooting and updates ``` ## Proposed solution 1. Add a default post-processing step to format the commit message body: - Wrap body lines at 72 characters. - Optionally warn if the subject line exceeds 50 characters. 2. Use the **mdformat** library to perform Markdown-aware formatting, preserving lists and code blocks. ## References - [StackOverflow: Git Commit Message Formatting (50/72)](https://stackoverflow.com/questions/2290016/git-commit-messages-50-72-formatting) - [`mdformat` documentation](https://mdformat.readthedocs.io/)
glenux changed title from Wrap message body at 72 caracters (and limit subject to 50) to [bug] Wrap message body at 72 caracters (and limit subject to 50) 2025-07-06 15:47:41 +00:00
glenux added this to the Default project 2025-07-06 15:52:48 +00:00
glenux changed title from [bug] Wrap message body at 72 caracters (and limit subject to 50) to Wrap message body at 72 caracters (and limit subject to 50) 2025-07-06 16:15:58 +00:00
Author
Owner

Fixed by a764e62f81

Fixed by a764e62f81b57a60fa837f7ac22cceafe78eb4e7
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: glenux/llm-commit-gen#5
No description provided.