mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
chore: Add a basic clang-tidy config (#1192)
* chore: Add .clang-tidy file * Fix some problems and non-problems
This commit is contained in:
parent
79da3e6637
commit
912843d698
5 changed files with 87 additions and 4 deletions
83
.clang-tidy
Normal file
83
.clang-tidy
Normal file
|
@ -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,
|
|
@ -840,7 +840,7 @@ void BitOpsFamily::Register(CommandRegistry* registry) {
|
||||||
<< CI{"BITFIELD", CO::WRITE, -3, 1, 1, 1}.SetHandler(&BitField)
|
<< CI{"BITFIELD", CO::WRITE, -3, 1, 1, 1}.SetHandler(&BitField)
|
||||||
<< CI{"BITFIELD_RO", CO::READONLY, -5, 1, 1, 1}.SetHandler(&BitFieldRo)
|
<< 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{"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);
|
<< CI{"SETBIT", CO::WRITE, 4, 1, 1, 1}.SetHandler(&SetBit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -700,7 +700,7 @@ error_code Replica::ConsumeDflyStream() {
|
||||||
|
|
||||||
// Iterate over map and cancle all blocking entities
|
// 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) {
|
for (auto& tx_data : multi_shard_exe_->tx_sync_execution) {
|
||||||
tx_data.second.barrier.Cancel();
|
tx_data.second.barrier.Cancel();
|
||||||
tx_data.second.block.Cancel();
|
tx_data.second.block.Cancel();
|
||||||
|
|
|
@ -604,7 +604,7 @@ OpResult<uint32_t> OpAdd(const OpArgs& op_args, std::string_view key, ArgSlice v
|
||||||
}
|
}
|
||||||
|
|
||||||
if (co.Encoding() != kEncodingIntSet) {
|
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);
|
db_slice.PostUpdate(op_args.db_cntx.db_index, it, key, !new_key);
|
||||||
|
|
|
@ -909,7 +909,7 @@ void XGroupHelp(CmdArgList args, ConnectionContext* cntx) {
|
||||||
" Create a new consumer in the specified group.",
|
" Create a new consumer in the specified group.",
|
||||||
"DELCONSUMER <key> <groupname> <consumer>",
|
"DELCONSUMER <key> <groupname> <consumer>",
|
||||||
" Remove the specified consumer.",
|
" Remove the specified consumer.",
|
||||||
"DESTROY <key> <groupname>"
|
"DESTROY <key> <groupname>",
|
||||||
" Remove the specified group.",
|
" Remove the specified group.",
|
||||||
"SETID <key> <groupname> <id|$>",
|
"SETID <key> <groupname> <id|$>",
|
||||||
" Set the current group ID.",
|
" Set the current group ID.",
|
||||||
|
|
Loading…
Reference in a new issue