diff --git a/.clang-tidy b/.clang-tidy index 5d530bcb76..f572f100ce 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -4,6 +4,10 @@ Checks: | clang-diagnostic-*, clang-analyzer-*, bugprone-redundant-branch-condition, + bugprone-use-after-move, + bugprone-bool-pointer-implicit-conversion, + bugprone-unused-raii, + bugprone-fold-init-type, modernize-*, -modernize-use-trailing-return-type, -modernize-use-nodiscard, @@ -24,10 +28,9 @@ Checks: | performance-faster-string-find, performance-inefficient-algorithm, performance-move-const-arg -WarningsAsErrors: '*' +WarningsAsErrors: "*" CheckOptions: - - key: readability-function-size.LineThreshold - value: '80' - - key: readability-function-cognitive-complexity.Threshold - value: '50' - + - key: readability-function-size.LineThreshold + value: "80" + - key: readability-function-cognitive-complexity.Threshold + value: "50" diff --git a/be/src/olap/rowset/segment_creator.cpp b/be/src/olap/rowset/segment_creator.cpp index 0fa0151b4b..66825a9fbb 100644 --- a/be/src/olap/rowset/segment_creator.cpp +++ b/be/src/olap/rowset/segment_creator.cpp @@ -218,7 +218,7 @@ Status SegmentFlusher::_expand_variant_to_subcolumns(vectorized::Block& block, VLOG_DEBUG << "dump rs schema: " << _context->tablet_schema->dump_structure(); } - block.swap(flush_block); + block.swap(flush_block); // NOLINT(bugprone-use-after-move) VLOG_DEBUG << "dump block: " << block.dump_data(); VLOG_DEBUG << "dump flush schema: " << flush_schema->dump_structure(); return Status::OK(); diff --git a/be/src/service/backend_service.cpp b/be/src/service/backend_service.cpp index fb98d60dce..a8171d2196 100644 --- a/be/src/service/backend_service.cpp +++ b/be/src/service/backend_service.cpp @@ -224,7 +224,8 @@ void _ingest_binlog(IngestBinlogArg* arg) { } // Step 5.2: check data capacity - uint64_t total_size = std::accumulate(segment_file_sizes.begin(), segment_file_sizes.end(), 0); + uint64_t total_size = std::accumulate(segment_file_sizes.begin(), segment_file_sizes.end(), + 0); // NOLINT(bugprone-fold-init-type) if (!local_tablet->can_add_binlog(total_size)) { LOG(WARNING) << "failed to add binlog, no enough space, total_size=" << total_size << ", tablet=" << local_tablet->tablet_id(); diff --git a/be/src/vec/common/hash_table/hash_table.h b/be/src/vec/common/hash_table/hash_table.h index 7e669f275e..04a5ff8f0e 100644 --- a/be/src/vec/common/hash_table/hash_table.h +++ b/be/src/vec/common/hash_table/hash_table.h @@ -611,10 +611,11 @@ public: std::swap(_need_partition, rhs._need_partition); std::swap(_partitioned_threshold, rhs._partitioned_threshold); - Hash::operator=(std::move(rhs)); - Allocator::operator=(std::move(rhs)); - Cell::State::operator=(std::move(rhs)); - ZeroValueStorage::operator=(std::move(rhs)); + Hash::operator=(std::move(rhs)); // NOLINT(bugprone-use-after-move) + Allocator::operator=(std::move(rhs)); // NOLINT(bugprone-use-after-move) + Cell::State::operator=(std::move(rhs)); // NOLINT(bugprone-use-after-move) + ZeroValueStorage::operator=( + std::move(rhs)); // NOLINT(bugprone-use-after-move) return *this; } diff --git a/be/src/vec/exec/format/orc/vorc_reader.cpp b/be/src/vec/exec/format/orc/vorc_reader.cpp index 436673722b..d1b908dbc2 100644 --- a/be/src/vec/exec/format/orc/vorc_reader.cpp +++ b/be/src/vec/exec/format/orc/vorc_reader.cpp @@ -1938,8 +1938,10 @@ Status OrcReader::on_string_dicts_loaded( auto data_type = slot_desc->get_data_type_ptr(); if (data_type->is_nullable()) { temp_block.insert( - {ColumnNullable::create(std::move(dict_value_column), - ColumnUInt8::create(dict_value_column_size, 0)), + {ColumnNullable::create( + std::move( + dict_value_column), // NOLINT(bugprone-use-after-move) + ColumnUInt8::create(dict_value_column_size, 0)), std::make_shared(std::make_shared()), ""}); } else { diff --git a/be/src/vec/exec/format/parquet/vparquet_group_reader.cpp b/be/src/vec/exec/format/parquet/vparquet_group_reader.cpp index 3784c054b8..1aea6a52c4 100644 --- a/be/src/vec/exec/format/parquet/vparquet_group_reader.cpp +++ b/be/src/vec/exec/format/parquet/vparquet_group_reader.cpp @@ -800,8 +800,10 @@ Status RowGroupReader::_rewrite_dict_predicates() { auto data_type = slot_desc->get_data_type_ptr(); if (data_type->is_nullable()) { temp_block.insert( - {ColumnNullable::create(std::move(dict_value_column), - ColumnUInt8::create(dict_value_column_size, 0)), + {ColumnNullable::create( + std::move( + dict_value_column), // NOLINT(bugprone-use-after-move) + ColumnUInt8::create(dict_value_column_size, 0)), std::make_shared(std::make_shared()), ""}); } else { diff --git a/be/src/vec/exec/scan/new_olap_scan_node.cpp b/be/src/vec/exec/scan/new_olap_scan_node.cpp index b11db29eb1..44a435ed2a 100644 --- a/be/src/vec/exec/scan/new_olap_scan_node.cpp +++ b/be/src/vec/exec/scan/new_olap_scan_node.cpp @@ -648,7 +648,7 @@ Status NewOlapScanNode::_init_scanners(std::list* scanners) { } const auto max_add_seg_nums = rs_seg_count[rowset_idx] - segment_idx_to_scan; - auto& split = rs_splits.emplace_back(); + auto& split = rs_splits.emplace_back(); // NOLINT(bugprone-use-after-move) split.rs_reader = read_source.rs_splits[rowset_idx].rs_reader->clone(); // if segments assigned to current scanner are already more than the average count, diff --git a/be/src/vec/functions/function.cpp b/be/src/vec/functions/function.cpp index e0f785b0ef..6a033d52f0 100644 --- a/be/src/vec/functions/function.cpp +++ b/be/src/vec/functions/function.cpp @@ -62,7 +62,7 @@ ColumnPtr wrap_in_nullable(const ColumnPtr& src, const Block& block, const Colum if (const auto* nullable = assert_cast(elem.column.get()); nullable->has_null()) { const ColumnPtr& null_map_column = nullable->get_null_map_column_ptr(); - if (!result_null_map_column) { + if (!result_null_map_column) { // NOLINT(bugprone-use-after-move) result_null_map_column = null_map_column->clone_resized(input_rows_count); continue; }