Commit 379d1ad1 authored by Lei Zhang's avatar Lei Zhang Committed by LUCI CQ

Simplify a block of conditionals for git cl lint.

Use continues to reduce the amount of nesting in a loop. At the same
time, give the variable involved better names.

Bug: 1097674
Change-Id: I105ed4a99da783fb235e304bbad4edd1f8a38889
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2298659Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
parent 6d938a0d
......@@ -3786,18 +3786,20 @@ def CMDlint(parser, args):
command = ['--filter=' + ','.join(options.filter)] + command
filenames = cpplint.ParseArguments(command)
white_regex = re.compile(settings.GetLintRegex())
black_regex = re.compile(settings.GetLintIgnoreRegex())
include_regex = re.compile(settings.GetLintRegex())
ignore_regex = re.compile(settings.GetLintIgnoreRegex())
extra_check_functions = [cpplint_chromium.CheckPointerDeclarationWhitespace]
for filename in filenames:
if white_regex.match(filename):
if black_regex.match(filename):
print('Ignoring file %s' % filename)
else:
cpplint.ProcessFile(filename, cpplint._cpplint_state.verbose_level,
extra_check_functions)
else:
if not include_regex.match(filename):
print('Skipping file %s' % filename)
continue
if ignore_regex.match(filename):
print('Ignoring file %s' % filename)
continue
cpplint.ProcessFile(filename, cpplint._cpplint_state.verbose_level,
extra_check_functions)
finally:
os.chdir(previous_cwd)
print('Total errors found: %d\n' % cpplint._cpplint_state.error_count)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment