From c6203d54d03ad994ebb51968a76c23411b7ab8b1 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Tue, 31 Jan 2023 14:33:50 +0100 Subject: [PATCH] refactor: simplify script/lint.js (#37077) Co-authored-by: Milan Burda --- script/lint.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/script/lint.js b/script/lint.js index 5267c85b618..c6d42aa0a33 100755 --- a/script/lint.js +++ b/script/lint.js @@ -86,11 +86,8 @@ const LINTERS = [{ roots: ['shell'], test: filename => filename.endsWith('.mm') || (filename.endsWith('.h') && isObjCHeader(filename)), run: (opts, filenames) => { - if (opts.fix) { - spawnAndCheckExitCode('python3', ['script/run-clang-format.py', '-r', '--fix', ...filenames]); - } else { - spawnAndCheckExitCode('python3', ['script/run-clang-format.py', '-r', ...filenames]); - } + const clangFormatFlags = opts.fix ? ['--fix'] : []; + spawnAndCheckExitCode('python3', ['script/run-clang-format.py', '-r', ...clangFormatFlags, ...filenames]); const filter = [ '-readability/braces', '-readability/casting',