Skip to content

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

@mattgebert

Description

@mattgebert

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions