This is an automated email from the ASF dual-hosted git repository.
mgreber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new c5dc22d17 [thirdparty] upgrade cpplint up to 1.6.1 release
c5dc22d17 is described below
commit c5dc22d175eee8ece16420ecf8f56d824de5861c
Author: Alexey Serbin <[email protected]>
AuthorDate: Fri Sep 19 17:17:36 2025 -0700
[thirdparty] upgrade cpplint up to 1.6.1 release
The prior version of the cpplint tool from the google-styleguide project
[1] was from 2016 and it wasn't aware of the C++17 constructs such as
'if constexpr (...) {...}', so it would error out on such a code with
messages like below:
If/else bodies with multiple statements require braces
[readability/braces]
At the time of writing, the latest released version of the cpplint tool
is 2.0.2 [2]. However, version 2.0.0 dropped Python2 and Python3.7
support, and it seems the 2.0.x release line is not quite stable yet.
The safest bet at this time is 1.6.1 which includes the fix for the
issue [3] and is the latest release in the 1.x line. It was released
about 3 years ago in August 2022.
Since the cpplint tool has been moved into a separate repo [4] and
it isn't a part of the google-styleguide project repo [1] anymore,
I renamed corresponding entities for this Kudu's 3rd-party component
and updated the scripts accordingly:
GSG --> CPPLINT
I also updated the list of cpplint filters to make the code pass the
checks of the upgraded cpplint tool. That should be addressed in
a separate follow-up changelist(s), and it might entail reconciliation
with the IWYU tool suggestions on the same set of header files, patching
the cpplint tool itself, addressing many of the runtime/string issues,
and adding NOLINT() where addressing the reported issues doesn't seem
viable:
* runtime/string is disabled since it doesn't recognize static
function declarations like in src/kudu/client/client.h, so it
will require either fixing it in cpplint itself or adding
NOLINT(runtime/string) as necessary
* build/include_what_you_use is disabled because it suggests including
the <utility> header in many places, but the IWYU tool itself
insists on removing it instead
[1] https://github.com/google/styleguide
[2] https://github.com/cpplint/cpplint/releases/tag/2.0.2
[3] https://github.com/cpplint/cpplint/commit/6e3e178b0
[4] https://github.com/cpplint/cpplint
Change-Id: I390dad51e8e0a57e5823ad789f7f8b0029e5bdb4
Reviewed-on: http://gerrit.cloudera.org:8080/23447
Tested-by: Alexey Serbin <[email protected]>
Reviewed-by: Marton Greber <[email protected]>
Reviewed-by: Gabriella Lotz <[email protected]>
---
build-support/lint.sh | 2 +-
thirdparty/LICENSE.txt | 6 +--
thirdparty/build-definitions.sh | 2 +-
thirdparty/build-thirdparty.sh | 4 +-
thirdparty/download-thirdparty.sh | 10 ++---
...cpplint.patch => cpplint-libstdcpp-regex.patch} | 51 +++-------------------
thirdparty/vars.sh | 17 +++++---
7 files changed, 29 insertions(+), 63 deletions(-)
diff --git a/build-support/lint.sh b/build-support/lint.sh
index 7f10f837b..53147a3ea 100755
--- a/build-support/lint.sh
+++ b/build-support/lint.sh
@@ -47,7 +47,7 @@ else
FILES=$(find $ROOT/src -name '*.cc' -or -name '*.h' | grep -v
"\.pb\.\|\.service\.\|\.proxy\.\|\.krpc\.\|gutil\|trace_event\|kudu_export\.h\|x509_check_host")
fi
-cpplint_filter="+runtime/broken_libstdcpp_regex,-whitespace/comments,-readability/todo,-readability/inheritance,-build/header_guard,-build/include_order,-legal/copyright,-build/c++11,-readability/nolint"
+cpplint_filter="+runtime/broken_libstdcpp_regex,-runtime/string,-whitespace/comments,-readability/todo,-readability/inheritance,-build/header_guard,-build/include_order,-build/include_what_you_use,-legal/copyright,-build/c++11,-readability/nolint"
cd $ROOT
THIRDPARTY_DIR=${THIRDPARTY_DIR:-$ROOT/thirdparty}
diff --git a/thirdparty/LICENSE.txt b/thirdparty/LICENSE.txt
index 55370d6a7..62412c4ec 100644
--- a/thirdparty/LICENSE.txt
+++ b/thirdparty/LICENSE.txt
@@ -634,9 +634,9 @@ NOTE: build-time dependency
TODO(KUDU-2696): gmock is unnecessarily linked into the kudu cli binary
--------------------------------------------------------------------------------
-thirdparty/src/google-styleguide-*/: CC-By 3.0
(http://creativecommons.org/licenses/by/3.0/)
-Source: https://github.com/google/styleguide
-NOTE: optional build-time dependency, not linked or bundled.
+thirdparty/src/cpplint-*/: BSD 3-clause license
+Source: https://github.com/cpplint/cpplint
+NOTE: optional build-time dependency, not linked or bundled
--------------------------------------------------------------------------------
thirdparty/src/python-*/: Python 2.7 license
(https://www.python.org/download/releases/2.7/license/)
diff --git a/thirdparty/build-definitions.sh b/thirdparty/build-definitions.sh
index 42fea9a20..24cc156aa 100644
--- a/thirdparty/build-definitions.sh
+++ b/thirdparty/build-definitions.sh
@@ -917,7 +917,7 @@ build_breakpad() {
build_cpplint() {
# Copy cpplint tool into bin directory
- cp $GSG_SOURCE/cpplint/cpplint.py $PREFIX/bin/cpplint.py
+ cp $CPPLINT_SOURCE/cpplint.py $PREFIX/bin/cpplint.py
}
build_gcovr() {
diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh
index 713bd0c99..2e2029d15 100755
--- a/thirdparty/build-thirdparty.sh
+++ b/thirdparty/build-thirdparty.sh
@@ -86,7 +86,7 @@ else
"zlib") F_ZLIB=1 ;;
"squeasel") F_SQUEASEL=1 ;;
"mustache") F_MUSTACHE=1 ;;
- "gsg") F_GSG=1 ;;
+ "cpplint") F_CPPLINT=1 ;;
"gcovr") F_GCOVR=1 ;;
"curl") F_CURL=1 ;;
"crcutil") F_CRCUTIL=1 ;;
@@ -234,7 +234,7 @@ if [ -n "$F_COMMON" -o -n "$F_RAPIDJSON" ]; then
build_rapidjson
fi
-if [ -n "$F_COMMON" -o -n "$F_GSG" ]; then
+if [ -n "$F_COMMON" -o -n "$F_CPPLINT" ]; then
build_cpplint
fi
diff --git a/thirdparty/download-thirdparty.sh
b/thirdparty/download-thirdparty.sh
index 3ad9256cf..09e711698 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -302,12 +302,12 @@ fetch_and_patch \
$MUSTACHE_SOURCE \
$MUSTACHE_PATCHLEVEL
-GSG_PATCHLEVEL=3
+CPPLINT_PATCHLEVEL=1
fetch_and_patch \
- google-styleguide-${GSG_VERSION}.tar.gz \
- $GSG_SOURCE \
- $GSG_PATCHLEVEL \
- "patch -p1 < $TP_DIR/patches/google-styleguide-cpplint.patch"
+ cpplint-${CPPLINT_VERSION}.tar.gz \
+ $CPPLINT_SOURCE \
+ $CPPLINT_PATCHLEVEL \
+ "patch -p1 < $TP_DIR/patches/cpplint-libstdcpp-regex.patch"
GCOVR_PATCHLEVEL=0
fetch_and_patch \
diff --git a/thirdparty/patches/google-styleguide-cpplint.patch
b/thirdparty/patches/cpplint-libstdcpp-regex.patch
similarity index 68%
rename from thirdparty/patches/google-styleguide-cpplint.patch
rename to thirdparty/patches/cpplint-libstdcpp-regex.patch
index 57857ac93..1df59a149 100644
--- a/thirdparty/patches/google-styleguide-cpplint.patch
+++ b/thirdparty/patches/cpplint-libstdcpp-regex.patch
@@ -1,6 +1,6 @@
---- a/cpplint/cpplint.py 2019-01-29 19:51:49.000000000 -0800
-+++ b/cpplint/cpplint.py 2019-01-30 15:19:26.000000000 -0800
-@@ -207,6 +207,7 @@
+--- a/cpplint.py 2019-01-30 15:19:26.000000000 -0800
++++ b/cpplint.py 2025-09-19 18:01:05.895383196 -0700
+@@ -325,6 +325,7 @@
'readability/todo',
'readability/utf8',
'runtime/arrays',
@@ -8,16 +8,7 @@
'runtime/casting',
'runtime/explicit',
'runtime/int',
-@@ -251,7 +252,7 @@
- # flag. By default all errors are on, so only add here categories that should
be
- # 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_alpha']
-+_DEFAULT_FILTERS = ['-build/include_alpha','-runtime/broken_libstdcpp_regex']
-
- # We used to check for high-bit characters, but after much discussion we
- # decided those were OK, as long as they were in UTF-8 and didn't represent
-@@ -1934,6 +1935,91 @@
+@@ -2651,6 +2652,91 @@
'...) for improved thread safety.')
@@ -109,41 +100,11 @@
def CheckVlogArguments(filename, clean_lines, linenum, error):
"""Checks that VLOG() is only used for defining a logging level.
-@@ -3111,8 +3111,8 @@
- line = clean_lines.elided[linenum]
-
- # You shouldn't have spaces before your brackets, except maybe after
-- # 'delete []' or 'return []() {};'
-- if Search(r'\w\s+\[', line) and not Search(r'(?:delete|return)\s+\[', line):
-+ # 'delete []', 'return []() {};', or 'auto [abc, ...] = ...;'.
-+ if Search(r'\w\s+\[', line) and not
Search(r'(?:auto&?|delete|return)\s+\[', line):
- error(filename, linenum, 'whitespace/braces', 5,
- 'Extra space before [')
-
-@@ -5488,7 +5574,7 @@
- ('<stack>', ('stack',)),
- ('<string>', ('char_traits', 'basic_string',)),
- ('<tuple>', ('tuple',)),
-- ('<utility>', ('pair',)),
-+ ('<utility>', ('pair', 'swap',)),
- ('<vector>', ('vector',)),
-
- # gcc extensions.
-@@ -5501,8 +5587,7 @@
- _RE_PATTERN_STRING = re.compile(r'\bstring\b')
-
- _re_pattern_algorithm_header = []
--for _template in ('copy', 'max', 'min', 'min_element', 'sort', 'swap',
-- 'transform'):
-+for _template in ('copy', 'max', 'min', 'min_element', 'sort', 'transform'):
- # Match max<type>(..., ...), max(..., ...), but not foo->max, foo.max or
- # type::max().
- _re_pattern_algorithm_header.append(
-@@ -5940,6 +6025,7 @@
+@@ -6391,6 +6477,7 @@
nesting_state, error)
CheckVlogArguments(filename, clean_lines, line, error)
CheckPosixThreading(filename, clean_lines, line, error)
+ CheckBrokenLibStdCppRegex(filename, clean_lines, line, error)
CheckInvalidIncrement(filename, clean_lines, line, error)
CheckMakePairUsesDeduction(filename, clean_lines, line, error)
- CheckDefaultLambdaCaptures(filename, clean_lines, line, error)
+ CheckRedundantVirtual(filename, clean_lines, line, error)
diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh
index 2a4524ec8..3e38411b8 100644
--- a/thirdparty/vars.sh
+++ b/thirdparty/vars.sh
@@ -115,12 +115,17 @@ MUSTACHE_VERSION=b290952d8eb93d085214d8c8c9eab8559df9f606
MUSTACHE_NAME=mustache-$MUSTACHE_VERSION
MUSTACHE_SOURCE=$TP_SOURCE_DIR/$MUSTACHE_NAME
-# git revision of google style guide:
-# https://github.com/google/styleguide
-# git archive --prefix=google-styleguide-$(git rev-parse HEAD)/ -o
/tmp/google-styleguide-$(git rev-parse HEAD).tgz HEAD
-GSG_VERSION=7a179d1ac2e08a5cc1622bec900d1e0452776713
-GSG_NAME=google-styleguide-$GSG_VERSION
-GSG_SOURCE=$TP_SOURCE_DIR/$GSG_NAME
+# git release/revision of cpplint https://github.com/cpplint/cpplint
+# (used to be a part of google styleguide https://github.com/google/styleguide)
+#
+# $ git clone https://github.com/cpplint/cpplint.git
+# $ cd cpplint
+# $ git tag -l # to see available tags/snapshots
+# $ git checkout 1.6.1 # checkout the sources of the chosen tag/snapshot
+# $ git archive --prefix=cpplint-1.6.1/ -o /tmp/cpplint-1.6.1.tar.gz HEAD
+CPPLINT_VERSION=1.6.1
+CPPLINT_NAME=cpplint-$CPPLINT_VERSION
+CPPLINT_SOURCE=$TP_SOURCE_DIR/$CPPLINT_NAME
GCOVR_VERSION=3.0
GCOVR_NAME=gcovr-$GCOVR_VERSION