Skip to content
Permalink
Browse files

chore: lint patch descriptions (#20919)

  • Loading branch information...
nornagon committed Nov 4, 2019
1 parent 04da8a1 commit 4de04da27a0d3d0176af91d96eeff9d5b4d0fdc4
Showing with 13 additions and 1 deletion.
  1. +13 −1 script/lint.js
@@ -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)
}
}
}]

0 comments on commit 4de04da

Please sign in to comment.
You can’t perform that action at this time.