Skip to content

Commit ec88547

Browse files
committed
chore: update pre-commit cmake format version and add cpplint check
1 parent 7169cb9 commit ec88547

31 files changed

+116
-37
lines changed

.pre-commit-config.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ repos:
4343
exclude: (^test/test_data/.*|^third_party/.*)
4444

4545
- repo: https://github.com/cheshirekow/cmake-format-precommit
46-
rev: v0.6.10
46+
rev: v0.6.13
4747
hooks:
4848
- id: cmake-format
4949
exclude: (^test/test_data/.*|^third_party/.*)
@@ -67,3 +67,23 @@ repos:
6767
'--disable',
6868
'dangling-hyphen,line-too-long',
6969
]
70+
71+
- repo: https://github.com/cpplint/cpplint
72+
rev: 1.6.1
73+
hooks:
74+
- id: cpplint
75+
alias: cpp
76+
name: C++ Lint
77+
args:
78+
- "--quiet"
79+
- "--verbose=2"
80+
- "--filter=-whitespace/line_length,-whitespace/parens,-build/c++11,-readability/nolint,-runtime/references"
81+
82+
types_or:
83+
- c++
84+
exclude: |
85+
(?x)^(
86+
(third_party)/.*|
87+
(test)/.*|
88+
(src)/.*
89+
)$

cmake_modules/BuildUtils.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,9 @@ function(add_test_case REL_TEST_NAME)
291291
add_dependencies(${LABEL_TEST_NAME} ${TEST_NAME})
292292
endforeach()
293293

294-
set_property(TEST ${TEST_NAME} APPEND PROPERTY LABELS ${LABELS})
294+
set_property(TEST ${TEST_NAME}
295+
APPEND
296+
PROPERTY LABELS ${LABELS})
295297
endfunction()
296298

297299
# Adding unit tests part of the "paimon" portion of the test suite

cmake_modules/SetupCxxFlags.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ if(NOT WIN32 AND NOT APPLE)
297297
# won't find it when invoked directly from make/ninja (which is typically
298298
# done outside devtoolset).
299299
execute_process(COMMAND which ld.gold
300-
OUTPUT_VARIABLE GOLD_LOCATION OUTPUT_STRIP_TRAILING_WHITESPACE
301-
ERROR_QUIET)
300+
OUTPUT_VARIABLE GOLD_LOCATION
301+
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
302302
if("${GOLD_LOCATION}" MATCHES "^/opt/rh/devtoolset")
303303
message("Skipping optional gold linker (version ${GOLD_VERSION}) because "
304304
"it's in devtoolset")

cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,7 @@ macro(build_fmt)
251251
externalproject_add(fmt_ep
252252
URL ${FMT_SOURCE_URL}
253253
URL_HASH "SHA256=${PAIMON_FMT_BUILD_SHA256_CHECKSUM}"
254-
${FMT_CONFIGURE}
255-
${THIRDPARTY_LOG_OPTIONS}
254+
${FMT_CONFIGURE} ${THIRDPARTY_LOG_OPTIONS}
256255
BUILD_BYPRODUCTS ${FMT_STATIC_LIB})
257256

258257
file(MAKE_DIRECTORY "${FMT_INCLUDE_DIR}")
@@ -340,8 +339,7 @@ macro(build_zstd)
340339
externalproject_add(zstd_ep
341340
URL ${ZSTD_SOURCE_URL}
342341
URL_HASH "SHA256=${PAIMON_ZSTD_BUILD_SHA256_CHECKSUM}"
343-
${ZSTD_CONFIGURE}
344-
${THIRDPARTY_LOG_OPTIONS}
342+
${ZSTD_CONFIGURE} ${THIRDPARTY_LOG_OPTIONS}
345343
BUILD_BYPRODUCTS ${ZSTD_STATIC_LIB})
346344

347345
file(MAKE_DIRECTORY "${ZSTD_INCLUDE_DIR}")
@@ -367,8 +365,7 @@ macro(build_lz4)
367365
externalproject_add(lz4_ep
368366
URL ${LZ4_SOURCE_URL}
369367
URL_HASH "SHA256=${PAIMON_LZ4_BUILD_SHA256_CHECKSUM}"
370-
${LZ4_CONFIGURE}
371-
${THIRDPARTY_LOG_OPTIONS}
368+
${LZ4_CONFIGURE} ${THIRDPARTY_LOG_OPTIONS}
372369
BUILD_BYPRODUCTS ${LZ4_STATIC_LIB})
373370

374371
file(MAKE_DIRECTORY "${LZ4_INCLUDE_DIR}")
@@ -510,8 +507,7 @@ macro(build_protobuf)
510507
externalproject_add(protobuf_ep
511508
URL ${PROTOBUF_SOURCE_URL}
512509
URL_HASH "SHA256=${PAIMON_PROTOBUF_BUILD_SHA256_CHECKSUM}"
513-
${PROTOBUF_CONFIGURE}
514-
${THIRDPARTY_LOG_OPTIONS}
510+
${PROTOBUF_CONFIGURE} ${THIRDPARTY_LOG_OPTIONS}
515511
# BUILD_IN_SOURCE 1
516512
BUILD_BYPRODUCTS "${PROTOBUF_STATIC_LIB}" "${PROTOBUF_COMPILER}"
517513
DEPENDS zlib)

include/paimon/file_index/file_indexer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#pragma once
1818

19+
#include <memory>
20+
1921
#include "paimon/file_index/file_index_reader.h"
2022
#include "paimon/file_index/file_index_result.h"
2123
#include "paimon/file_index/file_index_writer.h"

include/paimon/format/file_format.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
#pragma once
1818

19+
#include <memory>
20+
#include <string>
21+
1922
#include "paimon/format/format_stats_extractor.h"
2023
#include "paimon/format/reader_builder.h"
2124
#include "paimon/format/writer_builder.h"

include/paimon/format/format_stats_extractor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <memory>
2020
#include <string>
21+
#include <utility>
2122
#include <vector>
2223

2324
#include "paimon/result.h"

include/paimon/format/reader_builder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#pragma once
1818

1919
#include <memory>
20+
#include <string>
2021

2122
#include "paimon/memory/memory_pool.h"
2223
#include "paimon/reader/file_batch_reader.h"

include/paimon/global_index/bitmap_global_index_result.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <memory>
2020
#include <string>
21+
#include <utility>
2122

2223
#include "paimon/global_index/global_index_result.h"
2324
#include "paimon/utils/range.h"
@@ -33,7 +34,8 @@ namespace paimon {
3334
class PAIMON_EXPORT BitmapGlobalIndexResult : public GlobalIndexResult {
3435
public:
3536
using BitmapSupplier = std::function<Result<RoaringBitmap64>()>;
36-
BitmapGlobalIndexResult(BitmapSupplier bitmap_supplier) : bitmap_supplier_(bitmap_supplier) {}
37+
explicit BitmapGlobalIndexResult(BitmapSupplier bitmap_supplier)
38+
: bitmap_supplier_(bitmap_supplier) {}
3739

3840
class Iterator : public GlobalIndexResult::Iterator {
3941
public:

include/paimon/global_index/bitmap_topk_global_index_result.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
#include <memory>
2020
#include <string>
21+
#include <utility>
22+
#include <vector>
2123

2224
#include "paimon/global_index/global_index_result.h"
2325
#include "paimon/utils/roaring_bitmap64.h"
@@ -35,7 +37,7 @@ class PAIMON_EXPORT BitmapTopKGlobalIndexResult : public TopKGlobalIndexResult {
3537
public:
3638
BitmapTopKGlobalIndexResult(RoaringBitmap64&& bitmap, std::vector<float>&& scores)
3739
: bitmap_(std::move(bitmap)), scores_(std::move(scores)) {
38-
assert((size_t)bitmap_.Cardinality() == scores_.size());
40+
assert(static_cast<size_t>(bitmap_.Cardinality()) == scores_.size());
3941
}
4042

4143
class TopKIterator : public TopKGlobalIndexResult::TopKIterator {

0 commit comments

Comments
 (0)