jorisroovers / gitlint

Linting for your git commit messages
http://jorisroovers.github.io/gitlint
MIT License
821 stars 100 forks source link

Way to get diff information? #314

Closed matthiasbeyer closed 2 years ago

matthiasbeyer commented 2 years ago

Is there a way to get information about the diff of the actual commit the rule is working on?

I want to implement a check that compares the size of the diff to the size of the commit message and if a certain ratio is exceeded, emits an error or warning (e.g.: 1000 LOC change and only 1 line of message might be a no-no for some :smile: )

jorisroovers commented 2 years ago

This is something I've wanted to add but haven't gotten to. This should be fairly easy, I'll keep this issue open to get this implemented.

For now, there's a fairly easy workaround using gitlint.git._git, similar to the following example: https://github.com/jorisroovers/gitlint/issues/108#issuecomment-550492426

I'll re-iterate though that this is NOT officially supported, I'm not committing to keep that working in future versions of gitlint.

matthiasbeyer commented 2 years ago

Awesome, thanks for considering this! :tada:

jorisroovers commented 2 years ago

Implemented in #334, will go out with the next release (0.18.0)