build: account for subjectAndDescription null in patch linting (#42636)

fix: account for subjectAndDescription null in patch linting
This commit is contained in:
Shelley Vohr 2024-06-25 07:32:43 +02:00 committed by GitHub
parent 66b8b79229
commit 3534923bd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -252,8 +252,10 @@ const LINTERS = [{
const allOk = filenames.length > 0 && filenames.map(f => {
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.`);
return false;
}