mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
chore: lint patch descriptions (#20919)
This commit is contained in:
@@ -137,7 +137,7 @@ const LINTERS = [ {
|
||||
key: 'patches',
|
||||
roots: ['patches'],
|
||||
test: () => true,
|
||||
run: () => {
|
||||
run: (opts, filenames) => {
|
||||
const patchesDir = path.resolve(__dirname, '../patches')
|
||||
for (const patchTarget of fs.readdirSync(patchesDir)) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user