fix: cpplint didn't work in GN (#14581)
* fix: cpplint didn't work in GN * feat: make cpplint non-errors less noisy * refactor: remove unneeded findCppLint helper We don't need this in the GN world: it's the user's responsibility to have depot_tools in their path. * refactor: use const instead of let where possible
This commit is contained in:
parent
1682170d3d
commit
4b5cb7c548
1 changed files with 10 additions and 9 deletions
|
@ -2,18 +2,24 @@
|
||||||
|
|
||||||
const { GitProcess } = require('dugite')
|
const { GitProcess } = require('dugite')
|
||||||
const childProcess = require('child_process')
|
const childProcess = require('child_process')
|
||||||
const fs = require('fs')
|
|
||||||
const klaw = require('klaw')
|
const klaw = require('klaw')
|
||||||
const minimist = require('minimist')
|
const minimist = require('minimist')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const SOURCE_ROOT = path.normalize(path.dirname(__dirname))
|
const SOURCE_ROOT = path.normalize(path.dirname(__dirname))
|
||||||
const LINTER_PATH = path.join(SOURCE_ROOT, 'vendor', 'depot_tools', 'cpplint.py')
|
|
||||||
|
|
||||||
function callCpplint (filenames, args) {
|
function callCpplint (filenames, args) {
|
||||||
if (args.verbose) console.log([LINTER_PATH, ...filenames].join(' '))
|
const linter = 'cpplint.py'
|
||||||
|
if (args.verbose) console.log([linter, ...filenames].join(' '))
|
||||||
try {
|
try {
|
||||||
console.log(String(childProcess.execFileSync(LINTER_PATH, filenames, {cwd: SOURCE_ROOT})))
|
childProcess.execFile(linter, filenames, {cwd: SOURCE_ROOT}, (error, stdout, stderr) => {
|
||||||
|
if (error) {
|
||||||
|
console.warn(error)
|
||||||
|
}
|
||||||
|
for (const line of stderr.split(/[\r\n]+/)) {
|
||||||
|
if (!line.startsWith('Done processing ')) console.warn(line)
|
||||||
|
}
|
||||||
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
@ -87,11 +93,6 @@ const blacklist = new Set([
|
||||||
].map(tokens => path.join(SOURCE_ROOT, ...tokens)))
|
].map(tokens => path.join(SOURCE_ROOT, ...tokens)))
|
||||||
|
|
||||||
async function main () {
|
async function main () {
|
||||||
if (!fs.existsSync(LINTER_PATH)) {
|
|
||||||
console.log('[INFO] Skipping cpplint, dependencies have not been bootstrapped')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const args = parseCommandLine()
|
const args = parseCommandLine()
|
||||||
|
|
||||||
let filenames = []
|
let filenames = []
|
||||||
|
|
Loading…
Reference in a new issue