From b065ae215a95cf9ec87dc51007b738977cd799bd Mon Sep 17 00:00:00 2001 From: Jeff Donahue Date: Tue, 25 Feb 2014 13:39:20 -0800 Subject: [PATCH] add NOLINT_NEXTLINE to suppress linter errors on nextline --- scripts/cpplint.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/cpplint.py b/scripts/cpplint.py index 696a506..c5b14bd 100755 --- a/scripts/cpplint.py +++ b/scripts/cpplint.py @@ -433,8 +433,8 @@ _MATCH_ASM = re.compile(r'^\s*(?:asm|_asm|__asm|__asm__)' _regexp_compile_cache = {} -# Finds occurrences of NOLINT or NOLINT(...). -_RE_SUPPRESSION = re.compile(r'\bNOLINT\b(\([^)]*\))?') +# Finds occurrences of NOLINT[_NEXTLINE] or NOLINT[_NEXTLINE](...). +_RE_SUPPRESSION = re.compile(r'\bNOLINT(_NEXTLINE)?\b(\([^)]*\))?') # {str, set(int)}: a map from error categories to sets of linenumbers # on which those errors are expected and should be suppressed. @@ -468,7 +468,9 @@ def ParseNolintSuppressions(filename, raw_line, linenum, error): # FIXME(adonovan): "NOLINT(" is misparsed as NOLINT(*). matched = _RE_SUPPRESSION.search(raw_line) if matched: - category = matched.group(1) + if matched.group(1) == '_NEXTLINE': + linenum += 1 + category = matched.group(2) if category in (None, '(*)'): # => "suppress all" _error_suppressions.setdefault(None, set()).add(linenum) else: -- 2.7.4