Skip to content

Commit 9029981

Browse files
committed
tools: fix cpplint.py header rules
THIS COMMIT SHOULD GO WITH THE NEXT. IT WILL FIND NEW LINT. PR-URL: nodejs/node#26306 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent 247c14c commit 9029981

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

tools/cpplint.py

+13-12
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,10 @@ def GetNonHeaderExtensions():
282282
'build/forward_decl',
283283
'build/header_guard',
284284
'build/include',
285-
'build/include_subdir',
286285
'build/include_alpha',
286+
'build/include_inline',
287287
'build/include_order',
288+
'build/include_subdir',
288289
'build/include_what_you_use',
289290
'build/namespaces_literals',
290291
'build/namespaces',
@@ -356,8 +357,9 @@ def GetNonHeaderExtensions():
356357
# off by default (i.e., categories that must be enabled by the --filter= flags).
357358
# All entries here should start with a '-' or '+', as in the --filter= flag.
358359
_DEFAULT_FILTERS = [
359-
'-build/include',
360+
'-build/include_alpha',
360361
'-build/include_subdir',
362+
'-build/include_what_you_use',
361363
'-legal/copyright',
362364
]
363365

@@ -834,9 +836,9 @@ class _IncludeState(object):
834836
# needs to move backwards, CheckNextIncludeOrder will raise an error.
835837
_INITIAL_SECTION = 0
836838
_MY_H_SECTION = 1
837-
_C_SECTION = 2
838-
_CPP_SECTION = 3
839-
_OTHER_H_SECTION = 4
839+
_OTHER_H_SECTION = 2
840+
_C_SECTION = 3
841+
_CPP_SECTION = 4
840842

841843
_TYPE_NAMES = {
842844
_C_SYS_HEADER: 'C system header',
@@ -848,9 +850,9 @@ class _IncludeState(object):
848850
_SECTION_NAMES = {
849851
_INITIAL_SECTION: "... nothing. (This can't be an error.)",
850852
_MY_H_SECTION: 'a header this file implements',
853+
_OTHER_H_SECTION: 'other header',
851854
_C_SECTION: 'C system header',
852855
_CPP_SECTION: 'C++ system header',
853-
_OTHER_H_SECTION: 'other header',
854856
}
855857

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

21352137

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

47704772
# We want to ensure that headers appear in the right order:
4771-
# 1) for foo.cc, foo.h (preferred location)
4772-
# 2) c system files
4773-
# 3) cpp system files
4774-
# 4) for foo.cc, foo.h (deprecated location)
4775-
# 5) other google headers
4773+
# 1) for foo.cc, foo.h
4774+
# 2) other project headers
4775+
# 3) c system files
4776+
# 4) cpp system files
47764777
#
47774778
# We classify each include statement as one of those 5 types
47784779
# using a number of techniques. The include_state object keeps

0 commit comments

Comments
 (0)