cpplint: move a build/include check to subcategory
There is a cpplint include check that ensures that all includes have a
directory name preceding them. However, if all source lives in the root
of a repository, there is no point in having a directory.
Because this check lives under 'build/include', it's impossible to
filter without filtering other useful checks.
Move it to 'build/include_directory' so it can be more easily filtered.
BUG=chromium:1073191
TEST=cros lint on a file with 'filter=-build/include_directory' in
CPPLINT.cfg
Change-Id: Ie15fb2398a6d0297ef96219e67076ea262abf853
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2159690
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Fletcher Woodruff <fletcherw@chromium.org>
diff --git a/cpplint.py b/cpplint.py
index f7ad8d8..abfb511 100755
--- a/cpplint.py
+++ b/cpplint.py
@@ -188,6 +188,7 @@
'build/header_guard',
'build/include',
'build/include_alpha',
+ 'build/include_directory',
'build/include_order',
'build/include_what_you_use',
'build/namespaces',
@@ -424,8 +425,8 @@
r')$')
-# These headers are excluded from [build/include] and [build/include_order]
-# checks:
+# These headers are excluded from [build/include], [build/include_directory],
+# and [build/include_order] checks:
# - Anything not following google file name conventions (containing an
# uppercase character, such as Python.h or nsStringAPI.h, for example).
# - Lua headers.
@@ -4412,7 +4413,7 @@
# naming convention but not the include convention.
match = Match(r'#include\s*"([^/]+\.h)"', line)
if match and not _THIRD_PARTY_HEADERS_PATTERN.match(match.group(1)):
- error(filename, linenum, 'build/include', 4,
+ error(filename, linenum, 'build/include_directory', 4,
'Include the directory when naming .h files')
# we shouldn't include a file more than once. actually, there are a