Skip to content

Commit

Permalink
chore: Add a basic clang-tidy config (#1192)
Browse files Browse the repository at this point in the history
* chore: Add .clang-tidy file

* Fix some problems and non-problems
  • Loading branch information
royjacobson committed May 7, 2023
1 parent 02d72a7 commit 23954a9
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 4 deletions.
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};
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

0 comments on commit 23954a9

Please sign in to comment.