commitizen-tools/commitizen

Add config option for line length warning (`-l/--message-length-limit`)

Opened this issue · 3 comments

Description

In issue #191, it was suggested to be able to add command line arguments to commitizen to ensure the correct line length, implemented in #1076. This was further updated in #1178 to allow the same argument to be used in check in addition to commit.

Examples:

cz commit -l/--message-length-limit N

or

cz check -l N -m MESSAGE

However, the is not yet support in config or customisation to add such a default argument without requiring the command line specification.

Possible Solution

An additional config option should exist in the configuration file to optionally define a commit line length.
This would then be utilised by both commitizen pre-commit [commit-msg, pre-push] hooks and command line invocations on the root directory of a project (i.e. with the relevant pyproject.toml for a python package).

pyproject.toml

[tool.commitizen]
name = "cz_customize"

[tool.commitizen.customize]
  ... 
  message_length_limit = 72  # or l=72?

Then allowing the default parameter to propagate as follows:

cz commit
>>> fails / succeeds depending on message length

cz check -m MESSAGE
>>> fails / succeeds depending on message length

Additional context

No response

Related issues

No response

looks like a valid feature. Thanks for suggestion!

Hi @Lee-W, I'd be happy to help with this one. May I take it?

yep, sure :)