Skip to content

Validators #140

@cococonscious

Description

@cococonscious

Is your feature request related to a problem? Please describe.

  1. When making a commit through koji, but you forget to run git add or add the -a flag, you won't know until you're done writing the commit message. After that, you'd have to go through the whole prompt all over again.
  2. Some might not like the summary, scope or body being too long. Of course you could use other tools for validating the commit message, but then you'd have the same annoyance as in the first problem.

Describe the solution you'd like

An optional validator system should be added, which can handle various validations.
The necessary validations to have:

  • Maximum size of the scope, summary and/or body
  • Checking if any files are staged

These validators can be enabled, disabled and configured (perhaps it would be good to have a system for the "level" of the problem, as in only warning or blocking) through the configuration.

I'm not sure to which extend this is possible, but nice would be a good integration with the interactive prompts, showing the warning/error but also coloring the part of the entered value that's exceeding the configured maximum.

Describe alternatives you've considered

Using different tools: After the other tools fail, you'd have to re-run koji and re-enter every field again. Maybe it'd be possible to add a --retry flag to koji, but this would add complexity (where would the values of the last run be saved?) and I think koji should be able to handle those things by itself.

Additional context

Sub-issues

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions