chore: lint patch descriptions (#20919)
This commit is contained in:
parent
04da8a10eb
commit
4de04da27a
1 changed files with 13 additions and 1 deletions
|
@ -137,7 +137,7 @@ const LINTERS = [ {
|
||||||
key: 'patches',
|
key: 'patches',
|
||||||
roots: ['patches'],
|
roots: ['patches'],
|
||||||
test: () => true,
|
test: () => true,
|
||||||
run: () => {
|
run: (opts, filenames) => {
|
||||||
const patchesDir = path.resolve(__dirname, '../patches')
|
const patchesDir = path.resolve(__dirname, '../patches')
|
||||||
for (const patchTarget of fs.readdirSync(patchesDir)) {
|
for (const patchTarget of fs.readdirSync(patchesDir)) {
|
||||||
const targetDir = path.resolve(patchesDir, patchTarget)
|
const targetDir = path.resolve(patchesDir, patchTarget)
|
||||||
|
@ -180,6 +180,18 @@ const LINTERS = [ {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let ok = true
|
||||||
|
filenames.filter(f => f.endsWith('.patch')).forEach(f => {
|
||||||
|
const patchText = fs.readFileSync(f, 'utf8')
|
||||||
|
if (/^Subject: .*$\s+^diff/.test(patchText)) {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (!ok) {
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue