tools: cpplint: fix NOLINT(build/include_order)
And build/include, build/include_alpha and readability/streams probably too, though those are currently unused and therefore untested.
This commit is contained in:
parent
dce02a1055
commit
98c54246c2
5
tools/cpplint.py
vendored
5
tools/cpplint.py
vendored
@ -2283,6 +2283,7 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
|
|||||||
fileinfo = FileInfo(filename)
|
fileinfo = FileInfo(filename)
|
||||||
|
|
||||||
line = clean_lines.lines[linenum]
|
line = clean_lines.lines[linenum]
|
||||||
|
ParseNolintSuppressions(filename, line, linenum, error)
|
||||||
|
|
||||||
# we shouldn't include a file more than once. actually, there are a
|
# we shouldn't include a file more than once. actually, there are a
|
||||||
# handful of instances where doing so is okay, but in general it's
|
# handful of instances where doing so is okay, but in general it's
|
||||||
@ -2292,6 +2293,7 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
|
|||||||
include = match.group(2)
|
include = match.group(2)
|
||||||
is_system = (match.group(1) == '<')
|
is_system = (match.group(1) == '<')
|
||||||
if include in include_state:
|
if include in include_state:
|
||||||
|
if not IsErrorSuppressedByNolint('build/include', linenum):
|
||||||
error(filename, linenum, 'build/include', 4,
|
error(filename, linenum, 'build/include', 4,
|
||||||
'"%s" already included at %s:%s' %
|
'"%s" already included at %s:%s' %
|
||||||
(include, filename, include_state[include]))
|
(include, filename, include_state[include]))
|
||||||
@ -2309,6 +2311,7 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
|
|||||||
# using a number of techniques. The include_state object keeps
|
# using a number of techniques. The include_state object keeps
|
||||||
# track of the highest type seen, and complains if we see a
|
# track of the highest type seen, and complains if we see a
|
||||||
# lower type after that.
|
# lower type after that.
|
||||||
|
if not IsErrorSuppressedByNolint('build/include_order', linenum):
|
||||||
error_message = include_state.CheckNextIncludeOrder(
|
error_message = include_state.CheckNextIncludeOrder(
|
||||||
_ClassifyInclude(fileinfo, include, is_system))
|
_ClassifyInclude(fileinfo, include, is_system))
|
||||||
if error_message:
|
if error_message:
|
||||||
@ -2316,6 +2319,7 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
|
|||||||
'%s. Should be: %s.h, c system, c++ system, other.' %
|
'%s. Should be: %s.h, c system, c++ system, other.' %
|
||||||
(error_message, fileinfo.BaseName()))
|
(error_message, fileinfo.BaseName()))
|
||||||
if not include_state.IsInAlphabeticalOrder(include):
|
if not include_state.IsInAlphabeticalOrder(include):
|
||||||
|
if not IsErrorSuppressedByNolint('build/include_alpha', linenum):
|
||||||
error(filename, linenum, 'build/include_alpha', 4,
|
error(filename, linenum, 'build/include_alpha', 4,
|
||||||
'Include "%s" not in alphabetical order' % include)
|
'Include "%s" not in alphabetical order' % include)
|
||||||
|
|
||||||
@ -2326,6 +2330,7 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
|
|||||||
if Match(r'(f|ind|io|i|o|parse|pf|stdio|str|)?stream$', include):
|
if Match(r'(f|ind|io|i|o|parse|pf|stdio|str|)?stream$', include):
|
||||||
# Many unit tests use cout, so we exempt them.
|
# Many unit tests use cout, so we exempt them.
|
||||||
if not _IsTestFilename(filename):
|
if not _IsTestFilename(filename):
|
||||||
|
if not IsErrorSuppressedByNolint('readability/streams', linenum):
|
||||||
error(filename, linenum, 'readability/streams', 3,
|
error(filename, linenum, 'readability/streams', 3,
|
||||||
'Streams are highly discouraged.')
|
'Streams are highly discouraged.')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user