build: use upstream's presubmit cpplint filters. (#38638)
This commit is contained in:
parent
4956bcc6bd
commit
95d6a932ca
1 changed files with 28 additions and 8 deletions
|
@ -27,6 +27,32 @@ const IGNORELIST = new Set([
|
||||||
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
|
|
||||||
|
const CPPLINT_FILTERS = [
|
||||||
|
// from presubmit_canned_checks.py OFF_BY_DEFAULT_LINT_FILTERS
|
||||||
|
'-build/include',
|
||||||
|
'-build/include_order',
|
||||||
|
'-build/namespaces',
|
||||||
|
'-readability/casting',
|
||||||
|
'-runtime/int',
|
||||||
|
'-whitespace/braces',
|
||||||
|
// from presubmit_canned_checks.py OFF_UNLESS_MANUALLY_ENABLED_LINT_FILTERS
|
||||||
|
'-build/c++11',
|
||||||
|
'-build/header_guard',
|
||||||
|
'-readability/todo',
|
||||||
|
'-runtime/references',
|
||||||
|
'-whitespace/braces',
|
||||||
|
'-whitespace/comma',
|
||||||
|
'-whitespace/end_of_line',
|
||||||
|
'-whitespace/forcolon',
|
||||||
|
'-whitespace/indent',
|
||||||
|
'-whitespace/line_length',
|
||||||
|
'-whitespace/newline',
|
||||||
|
'-whitespace/operators',
|
||||||
|
'-whitespace/parens',
|
||||||
|
'-whitespace/semicolon',
|
||||||
|
'-whitespace/tab'
|
||||||
|
];
|
||||||
|
|
||||||
function spawnAndCheckExitCode (cmd, args, opts) {
|
function spawnAndCheckExitCode (cmd, args, opts) {
|
||||||
opts = { stdio: 'inherit', ...opts };
|
opts = { stdio: 'inherit', ...opts };
|
||||||
const { error, status, signal } = childProcess.spawnSync(cmd, args, opts);
|
const { error, status, signal } = childProcess.spawnSync(cmd, args, opts);
|
||||||
|
@ -75,7 +101,7 @@ const LINTERS = [{
|
||||||
const clangFormatFlags = opts.fix ? ['--fix'] : [];
|
const clangFormatFlags = opts.fix ? ['--fix'] : [];
|
||||||
for (const chunk of chunkFilenames(filenames)) {
|
for (const chunk of chunkFilenames(filenames)) {
|
||||||
spawnAndCheckExitCode('python3', ['script/run-clang-format.py', ...clangFormatFlags, ...chunk]);
|
spawnAndCheckExitCode('python3', ['script/run-clang-format.py', ...clangFormatFlags, ...chunk]);
|
||||||
cpplint(chunk);
|
cpplint([`--filter=${CPPLINT_FILTERS.join(',')}`, ...chunk]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
@ -85,13 +111,7 @@ const LINTERS = [{
|
||||||
run: (opts, filenames) => {
|
run: (opts, filenames) => {
|
||||||
const clangFormatFlags = opts.fix ? ['--fix'] : [];
|
const clangFormatFlags = opts.fix ? ['--fix'] : [];
|
||||||
spawnAndCheckExitCode('python3', ['script/run-clang-format.py', '-r', ...clangFormatFlags, ...filenames]);
|
spawnAndCheckExitCode('python3', ['script/run-clang-format.py', '-r', ...clangFormatFlags, ...filenames]);
|
||||||
const filter = [
|
const filter = [...CPPLINT_FILTERS, '-readability/braces'];
|
||||||
'-readability/braces',
|
|
||||||
'-readability/casting',
|
|
||||||
'-whitespace/braces',
|
|
||||||
'-whitespace/indent',
|
|
||||||
'-whitespace/parens'
|
|
||||||
];
|
|
||||||
cpplint(['--extensions=mm,h', `--filter=${filter.join(',')}`, ...filenames]);
|
cpplint(['--extensions=mm,h', `--filter=${filter.join(',')}`, ...filenames]);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue