fix(dev-infra): use all non-header content for checking commit body length (#41367)
As discovered in #41316, commit body length checks should consider all of the non-header content as the commit body rather than the conventional-commit-parser's current method of considering everything after an issue/PR reference to be the footer. PR Close #41367
This commit is contained in:
committed by
Alex Rickabaugh
parent
95ff5ecb23
commit
81a88c009c
@@ -131,8 +131,14 @@ export function validateCommitMessage(
|
||||
// Checking commit body //
|
||||
//////////////////////////
|
||||
|
||||
// Due to an issue in which conventional-commits-parser considers all parts of a commit after
|
||||
// a `#` reference to be the footer, we check the length of all of the commit content after the
|
||||
// header. In the future, we expect to be able to check only the body once the parser properly
|
||||
// handles this case.
|
||||
const allNonHeaderContent = `${commit.body.trim()}\n${commit.footer.trim()}`;
|
||||
|
||||
if (!config.minBodyLengthTypeExcludes?.includes(commit.type) &&
|
||||
commit.body.trim().length < config.minBodyLength) {
|
||||
allNonHeaderContent.length < config.minBodyLength) {
|
||||
errors.push(`The commit message body does not meet the minimum length of ${
|
||||
config.minBodyLength} characters`);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user