Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: bump cpplint to 1.6.0 #42416

Merged
merged 2 commits into from
Mar 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions tools/cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
same line, but it is far from perfect (in either direction).
"""

# cpplint predates fstrings
# pylint: disable=consider-using-f-string

# pylint: disable=invalid-name

import codecs
import copy
import getopt
Expand All @@ -59,7 +64,7 @@
# if empty, use defaults
_valid_extensions = set([])

__VERSION__ = '1.5.5'
__VERSION__ = '1.6.0'

try:
xrange # Python 2
Expand Down Expand Up @@ -1928,6 +1933,7 @@ def __init__(self, lines):
self.raw_lines = lines
self.num_lines = len(lines)
self.lines_without_raw_strings = CleanseRawStrings(lines)
# # pylint: disable=consider-using-enumerate
for linenum in range(len(self.lines_without_raw_strings)):
self.lines.append(CleanseComments(
self.lines_without_raw_strings[linenum]))
Expand Down Expand Up @@ -5164,10 +5170,12 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
#
# We also make an exception for Lua headers, which follow google
# 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_subdir', 4,
'Include the directory when naming .h files')
match = Match(r'#include\s*"([^/]+\.(.*))"', line)
if match:
if (IsHeaderExtension(match.group(2)) and
not _THIRD_PARTY_HEADERS_PATTERN.match(match.group(1))):
error(filename, linenum, 'build/include_subdir', 4,
'Include the directory when naming header files')

# 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
Expand Down Expand Up @@ -6620,7 +6628,7 @@ def ProcessConfigOverrides(filename):
continue

try:
with open(cfg_file) as file_handle:
with open(cfg_file, encoding='utf-8') as file_handle:
for line in file_handle:
line, _, _ = line.partition('#') # Remove comments.
if not line.strip():
Expand Down