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.5.5 #38851

Merged
merged 2 commits into from
Jun 1, 2021
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
21 changes: 11 additions & 10 deletions tools/cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
# if empty, use defaults
_valid_extensions = set([])

__VERSION__ = '1.5.4'
__VERSION__ = '1.5.5'

try:
xrange # Python 2
Expand Down Expand Up @@ -127,11 +127,11 @@
error messages whose category names pass the filters will be printed.
(Category names are printed with the message and look like
"[whitespace/indent]".) Filters are evaluated left to right.
"-FOO" and "FOO" means "do not print categories that start with FOO".
"-FOO" means "do not print categories that start with FOO".
"+FOO" means "do print categories that start with FOO".

Examples: --filter=-whitespace,+whitespace/braces
--filter=whitespace,runtime/printf,+runtime/printf_format
--filter=-whitespace,-runtime/printf,+runtime/printf_format
--filter=-,+build/include_what_you_use

To see a list of all the categories used in cpplint, pass no arg:
Expand Down Expand Up @@ -2350,7 +2350,8 @@ def StripListPrefix(lst, prefix):

# --root=.. , will prepend the outer directory to the header guard
full_path = fileinfo.FullName()
root_abspath = os.path.abspath(_root)
# adapt slashes for windows
root_abspath = os.path.abspath(_root).replace('\\', '/')

maybe_path = StripListPrefix(PathSplitToList(full_path),
PathSplitToList(root_abspath))
Expand Down Expand Up @@ -3499,7 +3500,7 @@ def CheckSpacingForFunctionCall(filename, clean_lines, linenum, error):
# Note that we assume the contents of [] to be short enough that
# they'll never need to wrap.
if ( # Ignore control structures.
not Search(r'\b(if|for|while|switch|return|new|delete|catch|sizeof)\b',
not Search(r'\b(if|elif|for|while|switch|return|new|delete|catch|sizeof)\b',
fncall) and
# Ignore pointers/references to functions.
not Search(r' \([^)]+\)\([^)]*(\)|,$)', fncall) and
Expand Down Expand Up @@ -5846,7 +5847,7 @@ def CheckCasts(filename, clean_lines, linenum, error):

if not expecting_function:
CheckCStyleCast(filename, clean_lines, linenum, 'static_cast',
r'\((int|float|double|bool|char|u?int(16|32|64))\)', error)
r'\((int|float|double|bool|char|u?int(16|32|64)|size_t)\)', error)

# This doesn't catch all cases. Consider (const char * const)"hello".
#
Expand Down Expand Up @@ -6783,10 +6784,10 @@ def PrintUsage(message):
Args:
message: The optional error message.
"""
sys.stderr.write(_USAGE % (list(GetAllExtensions()),
','.join(list(GetAllExtensions())),
GetHeaderExtensions(),
','.join(GetHeaderExtensions())))
sys.stderr.write(_USAGE % (sorted(list(GetAllExtensions())),
','.join(sorted(list(GetAllExtensions()))),
sorted(GetHeaderExtensions()),
','.join(sorted(GetHeaderExtensions()))))

if message:
sys.exit('\nFATAL ERROR: ' + message)
Expand Down