mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
fix: address code review suggestions
This commit is contained in:
@@ -11,9 +11,7 @@ const SOURCE_ROOT = path.normalize(path.dirname(__dirname))
|
||||
const LINTER_PATH = path.join(SOURCE_ROOT, 'vendor', 'depot_tools', 'cpplint.py')
|
||||
const ROOTS = ['atom', 'brightray'].map(token => path.join(SOURCE_ROOT, token))
|
||||
|
||||
function isBootstrapped () {
|
||||
return fs.existsSync(LINTER_PATH)
|
||||
}
|
||||
const isBootstrapped = () => fs.existsSync(LINTER_PATH)
|
||||
|
||||
function callCpplint (filenames, args) {
|
||||
if (args.verbose) console.log([LINTER_PATH, ...filenames].join(' '))
|
||||
@@ -57,9 +55,7 @@ async function findFiles (top, test) {
|
||||
})
|
||||
}
|
||||
|
||||
function isCCFile (filename) {
|
||||
return filename.endsWith('.cc') || filename.endsWith('.h')
|
||||
}
|
||||
const isCCFile = filename => filename.endsWith('.cc') || filename.endsWith('.h')
|
||||
|
||||
const blacklist = new Set([
|
||||
['atom', 'browser', 'mac', 'atom_application.h'],
|
||||
@@ -100,15 +96,15 @@ async function main () {
|
||||
const args = parseCommandLine()
|
||||
|
||||
let filenames = []
|
||||
for (let root of ROOTS) {
|
||||
let files = await findFiles(root, isCCFile)
|
||||
for (const root of ROOTS) {
|
||||
const files = await findFiles(root, isCCFile)
|
||||
filenames.push(...files)
|
||||
}
|
||||
|
||||
filenames = filenames.filter(x => !blacklist.has(x))
|
||||
|
||||
if (args.onlyChanged) {
|
||||
let whitelist = await findChangedFiles(SOURCE_ROOT)
|
||||
const whitelist = await findChangedFiles(SOURCE_ROOT)
|
||||
filenames = filenames.filter(x => whitelist.has(x))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user