diff --git a/docker/packager/packager b/docker/packager/packager index 836f30dec42..81474166cc9 100755 --- a/docker/packager/packager +++ b/docker/packager/packager @@ -154,6 +154,10 @@ def parse_env_variables(build_type, compiler, sanitizer, package_type, image_typ if clang_tidy: cmake_flags.append('-DENABLE_CLANG_TIDY=1') + cmake_flags.append('-DENABLE_UTILS=1') + cmake_flags.append('-DUSE_GTEST=1') + cmake_flags.append('-DENABLE_TESTS=1') + cmake_flags.append('-DENABLE_EXAMPLES=1') # Don't stop on first error to find more clang-tidy errors in one run. result.append('NINJA_FLAGS=-k0') diff --git a/src/Common/examples/lru_hash_map_perf.cpp b/src/Common/examples/lru_hash_map_perf.cpp index c40548bea49..7793f4262ff 100644 --- a/src/Common/examples/lru_hash_map_perf.cpp +++ b/src/Common/examples/lru_hash_map_perf.cpp @@ -19,7 +19,7 @@ public: using list_type = std::list>; using map_type = std::unordered_map; - LRUHashMapBasic(size_t max_size_, bool preallocated = false) + explicit LRUHashMapBasic(size_t max_size_, bool preallocated = false) : hash_map(preallocated ? max_size_ : 32) , max_size(max_size_) { diff --git a/src/Common/examples/parallel_aggregation2.cpp b/src/Common/examples/parallel_aggregation2.cpp index e2ad36232de..496331e203d 100644 --- a/src/Common/examples/parallel_aggregation2.cpp +++ b/src/Common/examples/parallel_aggregation2.cpp @@ -94,7 +94,7 @@ struct AggregateIndependentWithSequentialKeysOptimization if (it != begin && *it == prev_key) { assert(place != nullptr); - updater(place->getMapped()); + updater(place->getMapped()); // NOLINT continue; } prev_key = *it; diff --git a/src/Common/remapExecutable.cpp b/src/Common/remapExecutable.cpp index 5418290b24f..a774b1028d5 100644 --- a/src/Common/remapExecutable.cpp +++ b/src/Common/remapExecutable.cpp @@ -26,6 +26,7 @@ namespace ErrorCodes namespace { +/// NOLINTNEXTLINE(cert-dcl50-cpp) __attribute__((__noinline__)) int64_t our_syscall(...) { __asm__ __volatile__ (R"( diff --git a/src/Functions/replicate.cpp b/src/Functions/replicate.cpp index 796d5645a2e..5f6f187031f 100644 --- a/src/Functions/replicate.cpp +++ b/src/Functions/replicate.cpp @@ -55,7 +55,7 @@ ColumnPtr FunctionReplicate::executeImpl(const ColumnsWithTypeAndName & argument offsets = array_column->getOffsetsPtr(); } - const auto & offsets_data = assert_cast(*offsets).getData(); + const auto & offsets_data = assert_cast(*offsets).getData(); /// NOLINT return ColumnArray::create(first_column->replicate(offsets_data)->convertToFullColumnIfConst(), offsets); } diff --git a/src/IO/examples/parse_int_perf.cpp b/src/IO/examples/parse_int_perf.cpp index e35a3d8a857..5a8f8b01f50 100644 --- a/src/IO/examples/parse_int_perf.cpp +++ b/src/IO/examples/parse_int_perf.cpp @@ -81,8 +81,8 @@ int main(int argc, char ** argv) << "Written " << n << " numbers (" << wb.count() / 1000000.0 << " MB) in " << watch.elapsedSeconds() << " sec., " << n / watch.elapsedSeconds() << " num/s., " << wb.count() / watch.elapsedSeconds() / 1000000 << " MB/s., " - << watch.elapsed() / n << " ns/num., " - << tsc / n << " ticks/num., " + << watch.elapsed() / n << " ns/num., " // NOLINT + << tsc / n << " ticks/num., " // NOLINT << watch.elapsed() / wb.count() << " ns/byte., " << tsc / wb.count() << " ticks/byte." << std::endl; diff --git a/utils/zookeeper-test/main.cpp b/utils/zookeeper-test/main.cpp index 102c30e59a1..39a282ce258 100644 --- a/utils/zookeeper-test/main.cpp +++ b/utils/zookeeper-test/main.cpp @@ -73,8 +73,7 @@ void testCreateList(zkutil::ZooKeeper & zk) void testCreateSetVersionRequest(zkutil::ZooKeeper & zk) { zk.create("/data/check_data", "d", zkutil::CreateMode::Persistent); - Coordination::Stat stat; - std::string result = zk.get("/data/check_data", &stat); + Coordination::Stat stat{}; try { zk.set("/data/check_data", "e", stat.version + 2); @@ -224,7 +223,7 @@ std::string random_string(size_t length) "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz"; const size_t max_index = (sizeof(charset) - 1); - return charset[rand() % max_index]; + return charset[rand() % max_index]; /// NOLINT }; std::string str(length, 0); std::generate_n(str.begin(), length, randchar); @@ -259,9 +258,9 @@ void createOnPrefix(const std::string & zkhost, const String & path_prefix, size holder_futures.push_back(zk.asyncCreate(path, random_string(datasize), zkutil::CreateMode::Persistent)); } - for (size_t i = 0; i < holder_futures.size(); ++i) - holder_futures[i].get(); - } + for (auto & future : holder_futures) + future.get(); + } catch (...) { ::exit(-1);