gitlint is a handy tool and for example useful to limit the max line length of commit messages to 72 characters - as widely adopted standard across many projects. However, this rule also doesn't allow me to insert long links anymore. What can I do to have the best of both worlds?
gitlint is a handy tool and for example useful to limit the max line length of commit messages to 72 characters - as widely adopted standard across many projects. However, this rule also doesn't allow me to insert long links anymore. What can I do to have the best of both worlds?
Share Improve this question edited Mar 13 at 6:25 phip1611 asked Mar 12 at 10:26 phip1611phip1611 6,2305 gold badges41 silver badges75 bronze badges 2- "limit commit messages to a length of 72 characters" - surely you mean the commit message title? – 1615903 Commented Mar 13 at 5:53
- 1 YIKES, thanks. I adapted the question. I was talking about the max line length – phip1611 Commented Mar 13 at 6:26
1 Answer
Reset to default 0An easy solution is to use the ignore-body-lines configuration property. We can use a regex for each line starting with the pattern http[s]://
. We then can ignore the body-max-line-length rule for that given case.
[body-max-line-length]
line-length=72
# Don't annoy users when they add long links to useful resources
[ignore-by-body]
regex=^https?:\/\/
ignore=body-max-line-length
Now your commit message can look like this:
fix: security vulnerability in xyz
The bug [0] is now solved using the solution presented in [1].
[0]
http://very-very-very-very-very-very-very-very-very-very-very-very-very.long.link
[1]
https://very-very-very-very-very-very-very-very-very-very-very-very-very.long.link