[cpplint] Ignore fn_size check for macros with digits

In the cpplint fn_size check, there's a part where it explicitly
says to ignore macros, BUT the check for macro names didn't allow
for digits, which are present in the IPC_* macro names, which
look like "IPC_SYNC_MESSAGE_CONTROL4_1".

There are two interesting things about this:

1. This bug was filed in 2011! Yay for fixing a 5-digit crbug with
one-line fix!
2. This is a great example of how cpplint's regex-based checking is
error-prone compared to something that actually has access to an
abstract syntax tree.

Bug: 83036
Change-Id: I49acd80c265d7f7bc633f2092388525b4518ae23
Reviewed-on: https://chromium-review.googlesource.com/c/1483283
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
changes/83/1483283/4
Quinten Yearsley 6 years ago committed by Commit Bot
parent 151c3484da
commit 4809957b79

2
cpplint.py vendored

@ -2955,7 +2955,7 @@ def CheckForFunctionLengths(filename, clean_lines, linenum,
# ignore it, unless it's TEST or TEST_F.
function_name = match_result.group(1).split()[-1]
if function_name == 'TEST' or function_name == 'TEST_F' or (
not Match(r'[A-Z_]+$', function_name)):
not Match(r'[A-Z_0-9]+$', function_name)):
starting_func = True
if starting_func:

Loading…
Cancel
Save