Skip to content

Conversation

@bmrips
Copy link
Contributor

@bmrips bmrips commented Oct 18, 2025

The gitlint hook requires --msg-filename to appear last on the command line such that it is in front of the commit message filename. This is not the case when the args option is set. To fix this, we append --msg-filename to the args option.

Fixes #641.

@bmrips bmrips changed the title gitlint: put --msg-filename last in arg list gitlint: put --msg-filename last in argument list Oct 18, 2025
Copy link
Member

@sandydoo sandydoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

args are for end users to set. If a hook is designed in such a way that it cannot handle filenames as arguments, ie. without an option like --msg-filename, then we usually expose a settings.flags or, better yet, individual options.

@bmrips
Copy link
Contributor Author

bmrips commented Oct 19, 2025

I agree that the design of gitlint's CLI does not come in handy. With a flags option, however, we loose forward compatibility.

@sandydoo
Copy link
Member

With a flags option, however, we loose forward compatibility.

Not entirely sure what you mean by that

@bmrips
Copy link
Contributor Author

bmrips commented Oct 19, 2025

Not entirely sure what you mean by that

If we add gitlint.flags.* options and gitlint changes its CLI flags, we would have to keep them in sync.

@sandydoo
Copy link
Member

If we add gitlint.flags.* options and gitlint changes its CLI flags, we would have to keep them in sync.

Ah, I get it now. That's if we add individual settings.*. By flags I mean what a lot of the other hooks do: an array of strings. It's exactly like args, but can appear in docs and it's position can be controlled.

As far as API changes, that isn't a big deal in practice. These hook tools rarely change in practice. And if they do, well, we fix it here.

`gitlint.args` can not be used since pre-commits appends it to the
commandline but the `--msg-filename` option has to come last.

See cachix#641 for more information.
@bmrips bmrips changed the title gitlint: put --msg-filename last in argument list gitlint: add flags option Oct 23, 2025
@bmrips
Copy link
Contributor Author

bmrips commented Oct 23, 2025

Ok, I added the gitlint.flags option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gitlint: error on using "args"

2 participants