Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add a basic clang-tidy config #1192

Merged
merged 2 commits into from
May 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
83 changes: 83 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -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,
2 changes: 1 addition & 1 deletion src/server/bitops_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/server/replica.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, nice catch!

for (auto& tx_data : multi_shard_exe_->tx_sync_execution) {
tx_data.second.barrier.Cancel();
tx_data.second.block.Cancel();
Expand Down
2 changes: 1 addition & 1 deletion src/server/set_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ OpResult<uint32_t> 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);
Expand Down
2 changes: 1 addition & 1 deletion src/server/stream_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ void XGroupHelp(CmdArgList args, ConnectionContext* cntx) {
" Create a new consumer in the specified group.",
"DELCONSUMER <key> <groupname> <consumer>",
" Remove the specified consumer.",
"DESTROY <key> <groupname>"
"DESTROY <key> <groupname>",
" Remove the specified group.",
"SETID <key> <groupname> <id|$>",
" Set the current group ID.",
Expand Down