summaryrefslogtreecommitdiff
path: root/tools/cpplint.py
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2019-02-25 17:28:14 -0500
committerRefael Ackermann <refack@gmail.com>2019-03-12 09:56:59 -0400
commit902998190a55d6915b881936f6dd5b6e9cca6ad8 (patch)
treea4754dd54a2a8918874101672b0e8be4cb9ac2e7 /tools/cpplint.py
parent247c14c040026252814c3d4e8cffb8ac8748180e (diff)
downloadandroid-node-v8-902998190a55d6915b881936f6dd5b6e9cca6ad8.tar.gz
android-node-v8-902998190a55d6915b881936f6dd5b6e9cca6ad8.tar.bz2
android-node-v8-902998190a55d6915b881936f6dd5b6e9cca6ad8.zip
tools: fix cpplint.py header rules
THIS COMMIT SHOULD GO WITH THE NEXT. IT WILL FIND NEW LINT. PR-URL: https://github.com/nodejs/node/pull/26306 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'tools/cpplint.py')
-rwxr-xr-xtools/cpplint.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/tools/cpplint.py b/tools/cpplint.py
index bae2707476..034670dad9 100755
--- a/tools/cpplint.py
+++ b/tools/cpplint.py
@@ -282,9 +282,10 @@ _ERROR_CATEGORIES = [
'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',
@@ -356,8 +357,9 @@ _LEGACY_ERROR_CATEGORIES = [
# 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',
]
@@ -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',
@@ -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):
@@ -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):
@@ -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