build: lint patches for trailing whitespace (#26007)

This commit is contained in:
David Sanders 2020-10-19 18:40:58 -07:00 committed by GitHub
parent 6b6ffbdd10
commit 042ebdd5b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 12 deletions

View file

@ -186,6 +186,11 @@ const LINTERS = [{
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.`);
ok = false;
}
const trailingWhitespace = patchText.split('\n').filter(line => line.startsWith('+')).some(line => /\s+$/.test(line));
if (trailingWhitespace) {
console.warn(`Patch file '${f}' has trailing whitespace on some lines.`);
ok = false;
}
});
if (!ok) {
process.exit(1);