Skip to content

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

@glenux

Description

@glenux

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions