diff --git a/.clang-tidy b/.clang-tidy index 706730c464d..809df58829c 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -9,10 +9,8 @@ Checks: '*, -bugprone-easily-swappable-parameters, -bugprone-exception-escape, -bugprone-implicit-widening-of-multiplication-result, - -bugprone-lambda-function-name, -bugprone-narrowing-conversions, -bugprone-not-null-terminated-result, - -bugprone-unhandled-self-assignment, -cert-dcl16-c, -cert-err58-cpp, @@ -27,7 +25,31 @@ Checks: '*, -clang-analyzer-security.insecureAPI.bzero, -clang-analyzer-security.insecureAPI.strcpy, - -cppcoreguidelines-*, + -cppcoreguidelines-avoid-c-arrays, + -cppcoreguidelines-avoid-goto, + -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-avoid-non-const-global-variables, + -cppcoreguidelines-explicit-virtual-functions, + -cppcoreguidelines-init-variables, + -cppcoreguidelines-interfaces-global-init, + -cppcoreguidelines-macro-usage, + -cppcoreguidelines-narrowing-conversions, + -cppcoreguidelines-no-malloc, + -cppcoreguidelines-non-private-member-variables-in-classes, + -cppcoreguidelines-owning-memory, + -cppcoreguidelines-prefer-member-initializer, + -cppcoreguidelines-pro-bounds-array-to-pointer-decay, + -cppcoreguidelines-pro-bounds-constant-array-index, + -cppcoreguidelines-pro-bounds-pointer-arithmetic, + -cppcoreguidelines-pro-type-const-cast, + -cppcoreguidelines-pro-type-cstyle-cast, + -cppcoreguidelines-pro-type-member-init, + -cppcoreguidelines-pro-type-reinterpret-cast, + -cppcoreguidelines-pro-type-static-cast-downcast, + -cppcoreguidelines-pro-type-union-access, + -cppcoreguidelines-pro-type-vararg, + -cppcoreguidelines-slicing, + -cppcoreguidelines-special-member-functions, -concurrency-mt-unsafe, @@ -47,7 +69,6 @@ Checks: '*, -hicpp-braces-around-statements, -hicpp-explicit-conversions, -hicpp-function-size, - -hicpp-invalid-access-moved, -hicpp-member-init, -hicpp-move-const-arg, -hicpp-multiway-paths-covered, @@ -60,10 +81,10 @@ Checks: '*, -hicpp-uppercase-literal-suffix, -hicpp-use-auto, -hicpp-use-emplace, - -hicpp-use-noexcept, - -hicpp-use-override, -hicpp-vararg, + -linuxkernel-*, + -llvm-*, -llvmlibc-*, @@ -86,7 +107,6 @@ Checks: '*, -performance-inefficient-string-concatenation, -performance-no-int-to-ptr, - -performance-type-promotion-in-math-fn, -performance-unnecessary-value-param, -portability-simd-intrinsics, diff --git a/base/base/JSON.cpp b/base/base/JSON.cpp index 745fd821b83..54074f20f16 100644 --- a/base/base/JSON.cpp +++ b/base/base/JSON.cpp @@ -12,7 +12,7 @@ #define JSON_MAX_DEPTH 100 -POCO_IMPLEMENT_EXCEPTION(JSONException, Poco::Exception, "JSONException") // NOLINT(cert-err60-cpp, modernize-use-noexcept) +POCO_IMPLEMENT_EXCEPTION(JSONException, Poco::Exception, "JSONException") // NOLINT(cert-err60-cpp, modernize-use-noexcept, hicpp-use-noexcept) /// Прочитать беззнаковое целое в простом формате из не-0-terminated строки. diff --git a/src/Backups/BackupUtils.cpp b/src/Backups/BackupUtils.cpp index 33312e8b44b..270dad2d594 100644 --- a/src/Backups/BackupUtils.cpp +++ b/src/Backups/BackupUtils.cpp @@ -366,7 +366,7 @@ namespace { if (info.zk_path.empty()) { - for (auto & [relative_path, backup_entry] : info.data) + for (const auto & [relative_path, backup_entry] : info.data) res.emplace_back(info.data_path + relative_path, backup_entry); return; } @@ -374,7 +374,7 @@ namespace Strings data_paths = backup_coordination->getReplicatedTableDataPaths(info.zk_path); Strings part_names = backup_coordination->getReplicatedTablePartNames(backup_settings.host_id, info.table_name, info.zk_path); std::unordered_set part_names_set{part_names.begin(), part_names.end()}; - for (auto & [relative_path, backup_entry] : info.data) + for (const auto & [relative_path, backup_entry] : info.data) { size_t slash_pos = relative_path.find('/'); if (slash_pos != String::npos) diff --git a/src/Disks/DiskRestartProxy.cpp b/src/Disks/DiskRestartProxy.cpp index 8bb31cec55f..fab4e2148ca 100644 --- a/src/Disks/DiskRestartProxy.cpp +++ b/src/Disks/DiskRestartProxy.cpp @@ -54,7 +54,7 @@ public: RestartAwareWriteBuffer(const DiskRestartProxy & disk, std::unique_ptr impl_) : WriteBufferFromFileDecorator(std::move(impl_)), lock(disk.mutex) { } - virtual ~RestartAwareWriteBuffer() override + ~RestartAwareWriteBuffer() override { try { diff --git a/src/Functions/isIPAddressContainedIn.cpp b/src/Functions/isIPAddressContainedIn.cpp index f7c79299317..5ef247f7346 100644 --- a/src/Functions/isIPAddressContainedIn.cpp +++ b/src/Functions/isIPAddressContainedIn.cpp @@ -149,7 +149,7 @@ namespace DB } } - virtual DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override + DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override { if (arguments.size() != 2) throw Exception( @@ -166,7 +166,7 @@ namespace DB return std::make_shared(); } - virtual size_t getNumberOfArguments() const override { return 2; } + size_t getNumberOfArguments() const override { return 2; } bool useDefaultImplementationForNulls() const override { return false; } private: diff --git a/src/Functions/partitionId.cpp b/src/Functions/partitionId.cpp index eed3dd31bf9..c5dced68e88 100644 --- a/src/Functions/partitionId.cpp +++ b/src/Functions/partitionId.cpp @@ -45,7 +45,7 @@ public: return std::make_shared(); } - virtual ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t input_rows_count) const override + ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t input_rows_count) const override { Block sample_block(arguments); size_t size = arguments.size(); diff --git a/src/IO/S3Common.cpp b/src/IO/S3Common.cpp index c277332ef03..d7b3a9bde02 100644 --- a/src/IO/S3Common.cpp +++ b/src/IO/S3Common.cpp @@ -127,7 +127,7 @@ public: AWSEC2MetadataClient& operator =(const AWSEC2MetadataClient && rhs) = delete; AWSEC2MetadataClient(const AWSEC2MetadataClient && rhs) = delete; - virtual ~AWSEC2MetadataClient() override = default; + ~AWSEC2MetadataClient() override = default; using Aws::Internal::AWSHttpResourceClient::GetResource; @@ -264,10 +264,10 @@ public: { } - virtual ~AWSEC2InstanceProfileConfigLoader() override = default; + ~AWSEC2InstanceProfileConfigLoader() override = default; protected: - virtual bool LoadInternal() override + bool LoadInternal() override { auto credentials_str = use_secure_pull ? client->getDefaultCredentialsSecurely() : client->getDefaultCredentials(); diff --git a/src/Processors/Formats/Impl/AvroRowOutputFormat.cpp b/src/Processors/Formats/Impl/AvroRowOutputFormat.cpp index 70373480920..7b86dcd4a64 100644 --- a/src/Processors/Formats/Impl/AvroRowOutputFormat.cpp +++ b/src/Processors/Formats/Impl/AvroRowOutputFormat.cpp @@ -80,7 +80,7 @@ class OutputStreamWriteBufferAdapter : public avro::OutputStream public: explicit OutputStreamWriteBufferAdapter(WriteBuffer & out_) : out(out_) {} - virtual bool next(uint8_t ** data, size_t * len) override + bool next(uint8_t ** data, size_t * len) override { out.nextIfAtEnd(); *data = reinterpret_cast(out.position()); @@ -90,10 +90,10 @@ public: return true; } - virtual void backup(size_t len) override { out.position() -= len; } + void backup(size_t len) override { out.position() -= len; } - virtual uint64_t byteCount() const override { return out.count(); } - virtual void flush() override { } + uint64_t byteCount() const override { return out.count(); } + void flush() override { } private: WriteBuffer & out; diff --git a/src/Processors/Formats/Impl/ParallelParsingInputFormat.cpp b/src/Processors/Formats/Impl/ParallelParsingInputFormat.cpp index 27192829dde..0efb1d71004 100644 --- a/src/Processors/Formats/Impl/ParallelParsingInputFormat.cpp +++ b/src/Processors/Formats/Impl/ParallelParsingInputFormat.cpp @@ -91,7 +91,7 @@ void ParallelParsingInputFormat::parserThreadFunction(ThreadGroupStatusPtr threa while (!parsing_finished && (chunk = parser.getChunk()) != Chunk()) { /// Variable chunk is moved, but it is not really used in the next iteration. - /// NOLINTNEXTLINE(bugprone-use-after-move) + /// NOLINTNEXTLINE(bugprone-use-after-move, hicpp-invalid-access-moved) unit.chunk_ext.chunk.emplace_back(std::move(chunk)); unit.chunk_ext.block_missing_values.emplace_back(parser.getMissingValues()); }