Skip to content

Commit

Permalink
tools: fix cpplint.py header rules
Browse files Browse the repository at this point in the history
THIS COMMIT SHOULD GO WITH THE NEXT. IT WILL FIND NEW LINT.

PR-URL: nodejs#26306
Reviewed-By: Gireesh Punathil <[email protected]>
  • Loading branch information
refack committed Mar 12, 2019
1 parent 247c14c commit 9029981
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions tools/cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,10 @@ def GetNonHeaderExtensions():
'build/forward_decl',
'build/header_guard',
'build/include',
'build/include_subdir',
'build/include_alpha',
'build/include_inline',
'build/include_order',
'build/include_subdir',
'build/include_what_you_use',
'build/namespaces_literals',
'build/namespaces',
Expand Down Expand Up @@ -356,8 +357,9 @@ def GetNonHeaderExtensions():
# off by default (i.e., categories that must be enabled by the --filter= flags).
# All entries here should start with a '-' or '+', as in the --filter= flag.
_DEFAULT_FILTERS = [
'-build/include',
'-build/include_alpha',
'-build/include_subdir',
'-build/include_what_you_use',
'-legal/copyright',
]

Expand Down Expand Up @@ -834,9 +836,9 @@ class _IncludeState(object):
# needs to move backwards, CheckNextIncludeOrder will raise an error.
_INITIAL_SECTION = 0
_MY_H_SECTION = 1
_C_SECTION = 2
_CPP_SECTION = 3
_OTHER_H_SECTION = 4
_OTHER_H_SECTION = 2
_C_SECTION = 3
_CPP_SECTION = 4

_TYPE_NAMES = {
_C_SYS_HEADER: 'C system header',
Expand All @@ -848,9 +850,9 @@ class _IncludeState(object):
_SECTION_NAMES = {
_INITIAL_SECTION: "... nothing. (This can't be an error.)",
_MY_H_SECTION: 'a header this file implements',
_OTHER_H_SECTION: 'other header',
_C_SECTION: 'C system header',
_CPP_SECTION: 'C++ system header',
_OTHER_H_SECTION: 'other header',
}

def __init__(self):
Expand Down Expand Up @@ -2130,7 +2132,7 @@ def CheckInlineHeader(filename, include_state, error):
for name in bad_headers:
err = '%s includes both %s and %s-inl.h' % (filename, name, name)
linenum = all_headers[name]
error(filename, linenum, 'build/include', 5, err)
error(filename, linenum, 'build/include_inline', 5, err)


def CheckForNewlineAtEOF(filename, lines, error):
Expand Down Expand Up @@ -4768,11 +4770,10 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
include_state.include_list[-1].append((include, linenum))

# We want to ensure that headers appear in the right order:
# 1) for foo.cc, foo.h (preferred location)
# 2) c system files
# 3) cpp system files
# 4) for foo.cc, foo.h (deprecated location)
# 5) other google headers
# 1) for foo.cc, foo.h
# 2) other project headers
# 3) c system files
# 4) cpp system files
#
# We classify each include statement as one of those 5 types
# using a number of techniques. The include_state object keeps
Expand Down

0 comments on commit 9029981

Please sign in to comment.