Description
Expected Behavior
I want to be able to add links with long URLs (over 100 characters) to the footer so that I'll be able to adjust the footer line length in my own rules, while still assuring that the commit message body will be formatted consistently.
Alternatively there should be another way to add long urls to commits without having to minify them, while still adhering to the commit message max-line-length rules.
Current Behavior
It is impossible to create a commit containing a long url (over 100 characters), with the default config without minifying it.
I would prefer not to minify the URL as depending on the minification service the minified URL might not be online as long and I could potentially lose context information from the actual URL, which I can only find out by following the minfied one.
Putting a long URL in the body on a single line only works by adjusting the body-max-line-length
rule, reducing the usefulness of the configuration.
Example
docs(adl): commit message style convention
asserted by commitlint to [angular commit style]
https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#type-enum
according to the conventional commits convention.
Putting the URL as a markdown link in the footer does not work while adjusting footer-max-line-length
to Infinity
as it is recognized not as the footer, but as part of the body.
Example
docs(adl): commit message style convention
asserted by commitlint to [angular commit style] according to the
conventional commits convention.
[angular commit style]: https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#type-enum
results in
husky > pre-commit (node v12.18.2)
✔ Preparing...
✔ Running tasks...
✔ Applying modifications...
✔ Cleaning up...
husky > commit-msg (node v12.18.2)
⧗ input: docs(adl): commit message style convention
asserted by commitlint to [angular commit style] according to the
conventional-commits convention
[angular-commit-style]: https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional
✖ body's lines must not be longer than 100 characters [body-max-line-length]
✖ found 1 problems, 0 warnings
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
husky > commit-msg hook failed (add --no-verify to bypass)
This seems to be due to the conventional-commit-parser package only recognizing the footer by usage of either "BREAKING CHANGE:" or supplying some issue number link "#333".
I found this out by saving the above commit message to a test.txt
file and running the parser over it resulting in:
[
{
"type":"docs",
"scope":"adl",
"subject":"commit message style convention",
"merge":null,
"header":"docs(adl): commit message style convention",
"body":"asserted by commitlint to [angular commit style] according to the\n[conventional commits] convention.\n\n[angular commit style]: https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#type-enum",
"footer":null,
"notes":[],
"references":[],
"mentions":[],
"revert":null
}
]
Affected packages
- parse
- config-angular
Possible Solution
A solution could be to supply the conventional-commits-parser with a regex for specific noteKeywords.
Another solution could be to introduce an option to somehow ignore single line urls in the body of commit messages from the testing of body-max-line-length
rule.
But my question would also be how others normally add URLs to commit messges. Do you just always minify them?