build: account for subjectAndDescription
null in patch linting (#42636)
fix: account for subjectAndDescription null in patch linting
This commit is contained in:
parent
66b8b79229
commit
3534923bd2
1 changed files with 4 additions and 2 deletions
|
@ -252,8 +252,10 @@ const LINTERS = [{
|
||||||
|
|
||||||
const allOk = filenames.length > 0 && filenames.map(f => {
|
const allOk = filenames.length > 0 && filenames.map(f => {
|
||||||
const patchText = fs.readFileSync(f, 'utf8');
|
const patchText = fs.readFileSync(f, 'utf8');
|
||||||
const subjectAndDescription = /Subject: (.*?)\n\n([\s\S]*?)\s*(?=diff)/ms.exec(patchText);
|
|
||||||
if (!subjectAndDescription[2]) {
|
const regex = /Subject: (.*?)\n\n([\s\S]*?)\s*(?=diff)/ms;
|
||||||
|
const subjectAndDescription = regex.exec(patchText);
|
||||||
|
if (!subjectAndDescription?.[2]) {
|
||||||
console.warn(`Patch file '${f}' has no description. Every patch must contain a justification for why the patch exists and the plan for its removal.`);
|
console.warn(`Patch file '${f}' has no description. Every patch must contain a justification for why the patch exists and the plan for its removal.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue