diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 000000000..bd3abc561 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,83 @@ +--- + +Checks: > + -abseil-no-namespace, + bugprone*, + # Sadly narrowing conversions is too noisy + -bugprone-narrowing-conversions, + -bugprone-easily-swappable-parameters, + -bugprone-branch-clone, + -bugprone-implicit-widening-of-multiplication-result, + boost-use-to-string, + performance*, + cert*, + -cert-err58-cpp, + # Doesn't work with abseil flags + clang-analyzer*, + google-*, + -google-runtime-int, + -google-readability-*, + -google-build-using-namespace, + misc-definitions-in-headers, + misc-misleading*, + misc-misplaced-const, + misc-new-delete-overloads, + misc-non-copyable-objects, + misc-redundant-expression, + misc-static-assert, + misc-throw-by-value-catch-by-reference, + misc-unconventional-assign-operator, + misc-uniqueptr-reset-release, + misc-unused-alias-decls, + misc-unused-using-decls, + modernize-deprecated-headers, + modernize-macro-to-enum, + modernize-make-shared, + modernize-make-unique, + modernize-pass-by-value, + modernize-raw-string-literal, + modernize-redundant-void-arg, + modernize-replace-disallow-copy-and-assign-macro, + modernize-return-braced-init-list, + modernize-shrink-to-fit, + modernize-unary-static-assert, + modernize-use-emplace, + modernize-use-equals-delete, + modernize-use-noexcept, + modernize-use-transparent-functors, + modernize-use-uncaught-exceptions, + modernize-use-using, + readability-avoid-const-params-in-decls, + readability-const-return-type, + readability-container-contains, + readability-container-size-empty, + readability-delete-null-pointer, + readability-duplicate-include, + readability-function-size, + readability-identifier-naming, + readability-inconsistent-declaration-parameter-name, + readability-make-member-function-const, + readability-misplaced-array-index, + readability-named-parameter, + readability-non-const-parameter, + readability-redundant-access-specifiers, + readability-redundant-control-flow, + readability-redundant-declaration, + readability-redundant-function-ptr-dereference, + readability-redundant-member-init, + readability-redundant-preprocessor, + readability-redundant-smartptr-get, + readability-redundant-string-cstr, + readability-redundant-string-init, + readability-simplify-subscript-expr, + readability-static-definition-in-anonymous-namespace, + readability-string-compare, + readability-suspicious-call-argument, + readability-uniqueptr-delete-release, + readability-use-anyofallof + + +# Disabled because they're currently too disruptive, but one day might be nice to have: +# modernize-use-nullptr, +# modernize-use-equals-default, +# readability-qualified-auto, diff --git a/src/server/bitops_family.cc b/src/server/bitops_family.cc index 17a7dd4e5..4531e07d3 100644 --- a/src/server/bitops_family.cc +++ b/src/server/bitops_family.cc @@ -840,7 +840,7 @@ void BitOpsFamily::Register(CommandRegistry* registry) { << CI{"BITFIELD", CO::WRITE, -3, 1, 1, 1}.SetHandler(&BitField) << CI{"BITFIELD_RO", CO::READONLY, -5, 1, 1, 1}.SetHandler(&BitFieldRo) << CI{"BITOP", CO::WRITE | CO::NO_AUTOJOURNAL, -4, 2, -1, 1}.SetHandler(&BitOp) - << CI{"GETBIT", CO::READONLY | CO::FAST | CO::FAST, 3, 1, 1, 1}.SetHandler(&GetBit) + << CI{"GETBIT", CO::READONLY | CO::FAST, 3, 1, 1, 1}.SetHandler(&GetBit) << CI{"SETBIT", CO::WRITE, 4, 1, 1, 1}.SetHandler(&SetBit); } diff --git a/src/server/replica.cc b/src/server/replica.cc index b4a3e6690..dcdeacae2 100644 --- a/src/server/replica.cc +++ b/src/server/replica.cc @@ -700,7 +700,7 @@ error_code Replica::ConsumeDflyStream() { // Iterate over map and cancle all blocking entities { - lock_guard{multi_shard_exe_->map_mu}; + lock_guard l{multi_shard_exe_->map_mu}; for (auto& tx_data : multi_shard_exe_->tx_sync_execution) { tx_data.second.barrier.Cancel(); tx_data.second.block.Cancel(); diff --git a/src/server/set_family.cc b/src/server/set_family.cc index 43688ddbe..93f99b324 100644 --- a/src/server/set_family.cc +++ b/src/server/set_family.cc @@ -604,7 +604,7 @@ OpResult OpAdd(const OpArgs& op_args, std::string_view key, ArgSlice v } if (co.Encoding() != kEncodingIntSet) { - res = AddStrSet(op_args.db_cntx, std::move(vals), UINT32_MAX, &co); + res = AddStrSet(op_args.db_cntx, vals, UINT32_MAX, &co); } db_slice.PostUpdate(op_args.db_cntx.db_index, it, key, !new_key); diff --git a/src/server/stream_family.cc b/src/server/stream_family.cc index 4164bdf9c..62a896064 100644 --- a/src/server/stream_family.cc +++ b/src/server/stream_family.cc @@ -909,7 +909,7 @@ void XGroupHelp(CmdArgList args, ConnectionContext* cntx) { " Create a new consumer in the specified group.", "DELCONSUMER ", " Remove the specified consumer.", - "DESTROY " + "DESTROY ", " Remove the specified group.", "SETID ", " Set the current group ID.",