Repository: mesos Updated Branches: refs/heads/master e88fe8c31 -> ce7bb6e23
Updated cpplint from upstream. This patch updates the bundled cpplint to upstream '43d512b'. Review: https://reviews.apache.org/r/67127/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ce7bb6e2 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ce7bb6e2 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ce7bb6e2 Branch: refs/heads/master Commit: ce7bb6e23859c2410f6805d1c7b3eb32836a9a3c Parents: e88fe8c Author: Armand Grillet <[email protected]> Authored: Tue May 15 16:07:42 2018 +0200 Committer: Benjamin Bannier <[email protected]> Committed: Tue May 15 16:07:42 2018 +0200 ---------------------------------------------------------------------- support/cpplint.patch | 22 +++++++++++----------- support/cpplint.py | 30 +++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/ce7bb6e2/support/cpplint.patch ---------------------------------------------------------------------- diff --git a/support/cpplint.patch b/support/cpplint.patch index c29454d..69fbb5e 100644 --- a/support/cpplint.patch +++ b/support/cpplint.patch @@ -1,5 +1,5 @@ diff --git a/support/cpplint.py b/support/cpplint.py -index 53dbe81..7a020a4 100644 +index 6d44d3165..5089d50a9 100644 --- a/support/cpplint.py +++ b/support/cpplint.py @@ -28,6 +28,12 @@ @@ -10,7 +10,7 @@ index 53dbe81..7a020a4 100644 +# Modified by Avinash S ([email protected]) to check for at least +# a __single__ space in comments is required for hpp and cpp files. +# Modified by Tomek J ([email protected]) to check for NULL usage. -+ ++# Modified by Armand G ([email protected]) to skip file when linted. + """Does google-lint on c++ files. @@ -23,7 +23,7 @@ index 53dbe81..7a020a4 100644 import codecs import copy -@@ -210,6 +217,7 @@ _ERROR_CATEGORIES = [ +@@ -216,6 +223,7 @@ _ERROR_CATEGORIES = [ 'build/include_order', 'build/include_what_you_use', 'build/namespaces', @@ -31,7 +31,7 @@ index 53dbe81..7a020a4 100644 'build/printf_format', 'build/storage_class', 'legal/copyright', -@@ -552,7 +560,7 @@ _line_length = 80 +@@ -558,7 +566,7 @@ _line_length = 80 # The allowed extensions for file names # This is set by --extensions flag. @@ -40,7 +40,7 @@ index 53dbe81..7a020a4 100644 # Treat all headers starting with 'h' equally: .h, .hpp, .hxx etc. # This is set by --headers flag. -@@ -2364,14 +2372,14 @@ class _NamespaceInfo(_BlockInfo): +@@ -2370,14 +2378,14 @@ class _NamespaceInfo(_BlockInfo): if self.name: # Named namespace if not Match((r'^\s*};*\s*(//|/\*).*\bnamespace\s+' + @@ -58,7 +58,7 @@ index 53dbe81..7a020a4 100644 # If "// namespace anonymous" or "// anonymous namespace (more text)", # mention "// anonymous namespace" as an acceptable form if Match(r'^\s*}.*\b(namespace anonymous|anonymous namespace)\b', line): -@@ -2380,7 +2388,7 @@ class _NamespaceInfo(_BlockInfo): +@@ -2386,7 +2394,7 @@ class _NamespaceInfo(_BlockInfo): ' or "// anonymous namespace"') else: error(filename, linenum, 'readability/namespace', 5, @@ -67,7 +67,7 @@ index 53dbe81..7a020a4 100644 class _PreprocessorInfo(object): -@@ -2682,11 +2690,9 @@ class NestingState(object): +@@ -2688,11 +2696,9 @@ class NestingState(object): if access_match: classinfo.access = access_match.group(2) @@ -81,7 +81,7 @@ index 53dbe81..7a020a4 100644 if classinfo.is_struct: parent = 'struct ' + classinfo.name else: -@@ -2695,7 +2701,7 @@ class NestingState(object): +@@ -2701,7 +2707,7 @@ class NestingState(object): if access_match.group(3): slots = access_match.group(3) error(filename, linenum, 'whitespace/indent', 3, @@ -90,7 +90,7 @@ index 53dbe81..7a020a4 100644 access_match.group(2), slots, parent)) # Consume braces or semicolons from what's left of the line -@@ -3123,13 +3129,10 @@ def CheckComment(line, filename, linenum, next_line_start, error): +@@ -3129,13 +3135,10 @@ def CheckComment(line, filename, linenum, next_line_start, error): # Check if the // may be in quotes. If so, ignore it if re.sub(r'\\.', '', line[0:commentpos]).count('"') % 2 == 0: # Allow one space for new scopes, two spaces otherwise: @@ -107,7 +107,7 @@ index 53dbe81..7a020a4 100644 # Checks for common mistakes in TODO comments. comment = line[commentpos:] -@@ -3377,7 +3380,7 @@ def CheckOperatorSpacing(filename, clean_lines, linenum, error): +@@ -3383,7 +3386,7 @@ def CheckOperatorSpacing(filename, clean_lines, linenum, error): # those tend to be macros that deal with operators. match = Search(r'(operator|[^\s(<])(?:L|UL|LL|ULL|l|ul|ll|ull)?<<([^\s,=<])', line) if (match and not (match.group(1).isdigit() and match.group(2).isdigit()) and @@ -116,7 +116,7 @@ index 53dbe81..7a020a4 100644 error(filename, linenum, 'whitespace/operators', 3, 'Missing spaces around <<') -@@ -4394,6 +4397,10 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state, +@@ -4410,6 +4413,10 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state, error(filename, linenum, 'whitespace/newline', 0, 'More than one command on the same line') http://git-wip-us.apache.org/repos/asf/mesos/blob/ce7bb6e2/support/cpplint.py ---------------------------------------------------------------------- diff --git a/support/cpplint.py b/support/cpplint.py index 7a020a4..42a3dda 100644 --- a/support/cpplint.py +++ b/support/cpplint.py @@ -32,7 +32,7 @@ # Modified by Avinash S ([email protected]) to check for at least # a __single__ space in comments is required for hpp and cpp files. # Modified by Tomek J ([email protected]) to check for NULL usage. - +# Modified by Armand G ([email protected]) to skip file when linted. """Does google-lint on c++ files. @@ -58,6 +58,12 @@ import sre_compile import string import sys import unicodedata +import sysconfig + +try: + xrange # Python 2 +except NameError: + xrange = range # Python 3 _USAGE = """ @@ -577,7 +583,7 @@ def ProcessHppHeadersOption(val): # Automatically append to extensions list so it does not have to be set 2 times _valid_extensions.update(_hpp_headers) except ValueError: - PrintUsage('Header extensions must be comma seperated list.') + PrintUsage('Header extensions must be comma separated list.') def IsHeaderExtension(file_extension): return file_extension in _hpp_headers @@ -1854,8 +1860,8 @@ def GetHeaderGuardCPPVariable(filename): PathSplitToList(_root)) if _root_debug: - sys.stderr.write("_root lstrip (maybe_path=%s, file_path_from_root=%s," + - " _root=%s)\n" %(maybe_path, file_path_from_root, _root)) + sys.stderr.write(("_root lstrip (maybe_path=%s, file_path_from_root=%s," + + " _root=%s)\n") %(maybe_path, file_path_from_root, _root)) if maybe_path: return os.path.join(*maybe_path) @@ -1868,8 +1874,8 @@ def GetHeaderGuardCPPVariable(filename): PathSplitToList(root_abspath)) if _root_debug: - sys.stderr.write("_root prepend (maybe_path=%s, full_path=%s, " + - "root_abspath=%s)\n" %(maybe_path, full_path, root_abspath)) + sys.stderr.write(("_root prepend (maybe_path=%s, full_path=%s, " + + "root_abspath=%s)\n") %(maybe_path, full_path, root_abspath)) if maybe_path: return os.path.join(*maybe_path) @@ -4289,6 +4295,16 @@ def GetLineWidth(line): if unicodedata.east_asian_width(uc) in ('W', 'F'): width += 2 elif not unicodedata.combining(uc): + # Issue 337 + # https://mail.python.org/pipermail/python-list/2012-August/628809.html + if (sys.version_info.major, sys.version_info.minor) <= (3, 2): + # https://github.com/python/cpython/blob/2.7/Include/unicodeobject.h#L81 + is_wide_build = sysconfig.get_config_var("Py_UNICODE_SIZE") >= 4 + # https://github.com/python/cpython/blob/2.7/Objects/unicodeobject.c#L564 + is_low_surrogate = 0xDC00 <= ord(uc) <= 0xDFFF + if not is_wide_build and is_low_surrogate: + width -= 1 + width += 1 return width else: @@ -6195,7 +6211,7 @@ def ParseArguments(args): try: _valid_extensions = set(val.split(',')) except ValueError: - PrintUsage('Extensions must be comma seperated list.') + PrintUsage('Extensions must be comma separated list.') elif opt == '--headers': ProcessHppHeadersOption(val)
