You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by tw...@apache.org on 2023/04/14 07:02:24 UTC

[incubator-kvrocks] branch unstable updated: Check static class member and type alias name in readability-identifier-naming (#1387)

This is an automated email from the ASF dual-hosted git repository.

twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/incubator-kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new fcfe561a Check static class member and type alias name in readability-identifier-naming (#1387)
fcfe561a is described below

commit fcfe561aeb4c69d37f69b3aa111a21a07e5b1c26
Author: Twice <tw...@gmail.com>
AuthorDate: Fri Apr 14 15:02:18 2023 +0800

    Check static class member and type alias name in readability-identifier-naming (#1387)
---
 .clang-tidy                        | 16 ++++++-
 src/cluster/replication.cc         |  8 ++--
 src/cluster/replication.h          |  6 +--
 src/commands/command_parser.h      |  4 +-
 src/common/db_util.h               |  8 ++--
 src/common/event_util.h            | 10 ++--
 src/common/status.h                | 96 +++++++++++++++++++-------------------
 src/config/config.cc               |  4 +-
 src/config/config_type.h           | 20 ++++----
 src/server/redis_connection.cc     |  4 +-
 src/server/redis_connection.h      |  6 +--
 src/server/server.cc               |  9 ++--
 src/server/server.h                |  2 +-
 src/server/tls_util.h              | 12 ++---
 tests/cppunit/status_test.cc       |  8 ++--
 tests/cppunit/string_reply_test.cc | 14 +++---
 16 files changed, 119 insertions(+), 108 deletions(-)

diff --git a/.clang-tidy b/.clang-tidy
index 09ae2cdb..c4e2f261 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -12,12 +12,16 @@ CheckOptions:
     value:         False
   - key:           readability-identifier-naming.LocalVariableCase
     value:         lower_case
+  - key:           readability-identifier-naming.LocalConstantCase
+    value:         aNy_CasE  # FIXME: use a more strictly case
   - key:           readability-identifier-naming.StructCase
     value:         CamelCase
   - key:           readability-identifier-naming.ClassCase
     value:         CamelCase
   - key:           readability-identifier-naming.UnionCase
     value:         CamelCase
+  - key:           readability-identifier-naming.EnumCase
+    value:         CamelCase
   - key:           readability-identifier-naming.ParameterCase
     value:         lower_case
   # FIXME: enable these options
@@ -27,11 +31,19 @@ CheckOptions:
   #   value:         camelBack
   # - key:           readability-identifier-naming.ProtectedMethodCase
   #   value:         camelBack
-  - key:           readability-identifier-naming.LocalConstantCase
-    value:         aNy_CasE  # FIXME: use a more strictly case
   - key:           readability-identifier-naming.MemberCase
     value:         lower_case
   - key:           readability-identifier-naming.MemberSuffix
     value:         _
   - key:           readability-identifier-naming.PublicMemberCase
     value:         lower_case
+  - key:           readability-identifier-naming.ClassMemberCase
+    value:         lower_case
+  - key:           readability-identifier-naming.ClassConstantCase
+    value:         aNy_CasE  # FIXME: use a more strictly case
+  - key:           readability-identifier-naming.TypeAliasCase
+    value:         CamelCase
+  - key:           readability-identifier-naming.TypedefCase
+    value:         CamelCase
+  - key:           readability-identifier-naming.MacroCase
+    value:         UPPER_CASE
diff --git a/src/cluster/replication.cc b/src/cluster/replication.cc
index ca6090fc..c5a3a8ab 100644
--- a/src/cluster/replication.cc
+++ b/src/cluster/replication.cc
@@ -771,8 +771,8 @@ Status ReplicationThread::parallelFetchFile(const std::string &dir,
             crcs.push_back(f_crc);
           }
           unsigned files_count = files.size();
-          fetch_file_callback fn = [&fetch_cnt, &skip_cnt, files_count](const std::string &fetch_file,
-                                                                        const uint32_t fetch_crc) {
+          FetchFileCallback fn = [&fetch_cnt, &skip_cnt, files_count](const std::string &fetch_file,
+                                                                      const uint32_t fetch_crc) {
             fetch_cnt.fetch_add(1);
             uint32_t cur_skip_cnt = skip_cnt.load();
             uint32_t cur_fetch_cnt = fetch_cnt.load();
@@ -829,7 +829,7 @@ Status ReplicationThread::sendAuth(int sock_fd) {
 }
 
 Status ReplicationThread::fetchFile(int sock_fd, evbuffer *evbuf, const std::string &dir, const std::string &file,
-                                    uint32_t crc, const fetch_file_callback &fn) {
+                                    uint32_t crc, const FetchFileCallback &fn) {
   size_t file_size = 0;
 
   // Read file size line
@@ -888,7 +888,7 @@ Status ReplicationThread::fetchFile(int sock_fd, evbuffer *evbuf, const std::str
 }
 
 Status ReplicationThread::fetchFiles(int sock_fd, const std::string &dir, const std::vector<std::string> &files,
-                                     const std::vector<uint32_t> &crcs, const fetch_file_callback &fn) {
+                                     const std::vector<uint32_t> &crcs, const FetchFileCallback &fn) {
   std::string files_str;
   for (const auto &file : files) {
     files_str += file;
diff --git a/src/cluster/replication.h b/src/cluster/replication.h
index 87b3dcc6..886948e7 100644
--- a/src/cluster/replication.h
+++ b/src/cluster/replication.h
@@ -56,7 +56,7 @@ enum WriteBatchType {
   kBatchTypeStream,
 };
 
-using fetch_file_callback = std::function<void(const std::string, const uint32_t)>;
+using FetchFileCallback = std::function<void(const std::string, const uint32_t)>;
 
 class FeedSlaveThread {
  public:
@@ -193,9 +193,9 @@ class ReplicationThread {
   // Synchronized-Blocking ops
   Status sendAuth(int sock_fd);
   Status fetchFile(int sock_fd, evbuffer *evbuf, const std::string &dir, const std::string &file, uint32_t crc,
-                   const fetch_file_callback &fn);
+                   const FetchFileCallback &fn);
   Status fetchFiles(int sock_fd, const std::string &dir, const std::vector<std::string> &files,
-                    const std::vector<uint32_t> &crcs, const fetch_file_callback &fn);
+                    const std::vector<uint32_t> &crcs, const FetchFileCallback &fn);
   Status parallelFetchFile(const std::string &dir, const std::vector<std::pair<std::string, uint32_t>> &files);
   static bool isRestoringError(const char *err);
   static bool isWrongPsyncNum(const char *err);
diff --git a/src/commands/command_parser.h b/src/commands/command_parser.h
index e66cad98..46f538c0 100644
--- a/src/commands/command_parser.h
+++ b/src/commands/command_parser.h
@@ -39,7 +39,7 @@ struct MoveIterator : Iter {
 template <typename Iter>
 struct CommandParser {
  public:
-  using value_type = typename Iter::value_type;
+  using ValueType = typename Iter::value_type;
 
   CommandParser(Iter begin, Iter end) : begin_(std::move(begin)), end_(std::move(end)) {}
 
@@ -87,7 +87,7 @@ struct CommandParser {
     return false;
   }
 
-  StatusOr<value_type> TakeStr() {
+  StatusOr<ValueType> TakeStr() {
     if (!Good()) return {Status::RedisParseErr, "no more item to parse"};
 
     return RawTake();
diff --git a/src/common/db_util.h b/src/common/db_util.h
index 002e9b7b..1a413d3b 100644
--- a/src/common/db_util.h
+++ b/src/common/db_util.h
@@ -29,14 +29,14 @@
 namespace DBUtil {
 
 struct UniqueIterator : std::unique_ptr<rocksdb::Iterator> {
-  using base_type = std::unique_ptr<rocksdb::Iterator>;
+  using BaseType = std::unique_ptr<rocksdb::Iterator>;
 
-  explicit UniqueIterator(rocksdb::Iterator* iter) : base_type(iter) {}
+  explicit UniqueIterator(rocksdb::Iterator* iter) : BaseType(iter) {}
   UniqueIterator(Engine::Storage* storage, const rocksdb::ReadOptions& options,
                  rocksdb::ColumnFamilyHandle* column_family)
-      : base_type(storage->NewIterator(options, column_family)) {}
+      : BaseType(storage->NewIterator(options, column_family)) {}
   UniqueIterator(Engine::Storage* storage, const rocksdb::ReadOptions& options)
-      : base_type(storage->NewIterator(options)) {}
+      : BaseType(storage->NewIterator(options)) {}
 };
 
 }  // namespace DBUtil
diff --git a/src/common/event_util.h b/src/common/event_util.h
index 3b757e18..b7c78e04 100644
--- a/src/common/event_util.h
+++ b/src/common/event_util.h
@@ -38,9 +38,9 @@ using StaticFree = StaticFunction<decltype(std::free), std::free>;
 
 template <typename T>
 struct UniqueFreePtr : std::unique_ptr<T, StaticFree> {
-  using base_type = std::unique_ptr<T, StaticFree>;
+  using BaseType = std::unique_ptr<T, StaticFree>;
 
-  using base_type::base_type;
+  using BaseType::BaseType;
 };
 
 struct UniqueEvbufReadln : UniqueFreePtr<char[]> {
@@ -53,8 +53,8 @@ struct UniqueEvbufReadln : UniqueFreePtr<char[]> {
 using StaticEvbufFree = StaticFunction<decltype(evbuffer_free), evbuffer_free>;
 
 struct UniqueEvbuf : std::unique_ptr<evbuffer, StaticEvbufFree> {
-  using base_type = std::unique_ptr<evbuffer, StaticEvbufFree>;
+  using BaseType = std::unique_ptr<evbuffer, StaticEvbufFree>;
 
-  UniqueEvbuf() : base_type(evbuffer_new()) {}
-  explicit UniqueEvbuf(evbuffer *buffer) : base_type(buffer) {}
+  UniqueEvbuf() : BaseType(evbuffer_new()) {}
+  explicit UniqueEvbuf(evbuffer *buffer) : BaseType(buffer) {}
 };
diff --git a/src/common/status.h b/src/common/status.h
index 2cc41bc9..55cfcef1 100644
--- a/src/common/status.h
+++ b/src/common/status.h
@@ -127,7 +127,7 @@ class [[nodiscard]] Status {
 
   std::unique_ptr<Impl> impl_;
 
-  static constexpr Code cOK = static_cast<Code>(0);
+  static constexpr Code cOK = static_cast<Code>(0);  // NOLINT
 
   template <typename>
   friend struct StatusOr;
@@ -135,21 +135,21 @@ class [[nodiscard]] Status {
 
 namespace type_details {
 template <typename... Ts>
-using first_element_t = typename std::tuple_element_t<0, std::tuple<Ts...>>;
+using FirstElement = typename std::tuple_element_t<0, std::tuple<Ts...>>;
 
 template <typename T>
-using remove_cvref_t = typename std::remove_cv_t<typename std::remove_reference_t<T>>;
+using RemoveCVRef = typename std::remove_cv_t<typename std::remove_reference_t<T>>;
 }  // namespace type_details
 
 template <typename, typename = void>
 struct StringInStatusOr : private std::string {
-  using base_type = std::string;
+  using BaseType = std::string;
   static constexpr bool inplace = true;
 
-  explicit StringInStatusOr(std::string&& v) : base_type(std::move(v)) {}
+  explicit StringInStatusOr(std::string&& v) : BaseType(std::move(v)) {}
 
   template <typename U>
-  StringInStatusOr(StringInStatusOr<U>&& v) : base_type(*std::move(v)) {}  // NOLINT
+  StringInStatusOr(StringInStatusOr<U>&& v) : BaseType(*std::move(v)) {}  // NOLINT
   StringInStatusOr(const StringInStatusOr& v) = delete;
 
   StringInStatusOr& operator=(const StringInStatusOr&) = delete;
@@ -165,26 +165,26 @@ struct StringInStatusOr : private std::string {
 
 template <typename T>
 struct StringInStatusOr<T, std::enable_if_t<sizeof(T) < sizeof(std::string)>> : private std::unique_ptr<std::string> {
-  using base_type = std::unique_ptr<std::string>;
+  using BaseType = std::unique_ptr<std::string>;
   static constexpr bool inplace = false;
 
-  explicit StringInStatusOr(std::string&& v) : base_type(new std::string(std::move(v))) {}
+  explicit StringInStatusOr(std::string&& v) : BaseType(new std::string(std::move(v))) {}
 
   template <typename U, typename std::enable_if_t<StringInStatusOr<U>::inplace, int> = 0>
-  StringInStatusOr(StringInStatusOr<U>&& v) : base_type(new std::string(*std::move(v))) {}  // NOLINT
+  StringInStatusOr(StringInStatusOr<U>&& v) : BaseType(new std::string(*std::move(v))) {}  // NOLINT
   template <typename U, typename std::enable_if_t<!StringInStatusOr<U>::inplace, int> = 0>
   StringInStatusOr(StringInStatusOr<U>&& v)  // NOLINT
-      : base_type((typename StringInStatusOr<U>::base_type &&)(std::move(v))) {}
+      : BaseType((typename StringInStatusOr<U>::BaseType &&)(std::move(v))) {}
 
   StringInStatusOr(const StringInStatusOr& v) = delete;
 
   StringInStatusOr& operator=(const StringInStatusOr&) = delete;
 
-  std::string& operator*() & { return base_type::operator*(); }
+  std::string& operator*() & { return BaseType::operator*(); }
 
-  const std::string& operator*() const& { return base_type::operator*(); }
+  const std::string& operator*() const& { return BaseType::operator*(); }
 
-  std::string&& operator*() && { return std::move(base_type::operator*()); }
+  std::string&& operator*() && { return std::move(BaseType::operator*()); }
 
   ~StringInStatusOr() = default;
 };
@@ -200,37 +200,37 @@ struct IsStatusOr<StatusOr<T>> : std::integral_constant<bool, true> {};
 
 template <typename T>
 struct [[nodiscard]] StatusOr {
-  static_assert(!std::is_same_v<T, Status>, "value_type cannot be Status");
-  static_assert(!std::is_same_v<T, Status::Code>, "value_type cannot be Status::Code");
-  static_assert(!IsStatusOr<T>::value, "value_type cannot be StatusOr");
-  static_assert(!std::is_reference_v<T>, "value_type cannot be reference");
+  static_assert(!std::is_same_v<T, Status>, "ValueType cannot be Status");
+  static_assert(!std::is_same_v<T, Status::Code>, "ValueType cannot be Status::Code");
+  static_assert(!IsStatusOr<T>::value, "ValueType cannot be StatusOr");
+  static_assert(!std::is_reference_v<T>, "ValueType cannot be reference");
 
-  using value_type = T;
+  using ValueType = T;
 
   // we use std::unique_ptr to make the error part as small as enough
-  using error_type = StringInStatusOr<value_type>;
+  using ErrorType = StringInStatusOr<ValueType>;
 
   using Code = Status::Code;
 
   StatusOr(Status s) : code_(s.GetCode()) {  // NOLINT
     CHECK(!s);
-    new (&error) error_type(std::move(s.impl_->msg));
+    new (&error) ErrorType(std::move(s.impl_->msg));
   }
 
   StatusOr(Code code, std::string msg = {}) : code_(code) {  // NOLINT
     CHECK(code != Status::cOK);
-    new (&error) error_type(std::move(msg));
+    new (&error) ErrorType(std::move(msg));
   }
 
-  template <typename... Ts,
-            typename std::enable_if<
-                (sizeof...(Ts) > 0 &&
-                 !std::is_same_v<Status, type_details::remove_cvref_t<type_details::first_element_t<Ts...>>> &&
-                 !std::is_same_v<Code, type_details::remove_cvref_t<type_details::first_element_t<Ts...>>> &&
-                 !std::is_same_v<StatusOr, type_details::remove_cvref_t<type_details::first_element_t<Ts...>>>),
-                int>::type = 0>                  // NOLINT
+  template <
+      typename... Ts,
+      typename std::enable_if<(sizeof...(Ts) > 0 &&
+                               !std::is_same_v<Status, type_details::RemoveCVRef<type_details::FirstElement<Ts...>>> &&
+                               !std::is_same_v<Code, type_details::RemoveCVRef<type_details::FirstElement<Ts...>>> &&
+                               !std::is_same_v<StatusOr, type_details::RemoveCVRef<type_details::FirstElement<Ts...>>>),
+                              int>::type = 0>    // NOLINT
   StatusOr(Ts&&... args) : code_(Status::cOK) {  // NOLINT
-    new (&value) value_type(std::forward<Ts>(args)...);
+    new (&value) ValueType(std::forward<Ts>(args)...);
   }
 
   StatusOr(const StatusOr&) = delete;
@@ -238,16 +238,16 @@ struct [[nodiscard]] StatusOr {
   template <typename U, typename std::enable_if<std::is_convertible<U, T>::value, int>::type = 0>
   StatusOr(StatusOr<U>&& other) : code_(other.code_) {  // NOLINT
     if (code_ == Status::cOK) {
-      new (&value) value_type(std::move(other.value));
+      new (&value) ValueType(std::move(other.value));
     } else {
-      new (&error) error_type(std::move(other.error));
+      new (&error) ErrorType(std::move(other.error));
     }
   }
 
   template <typename U, typename std::enable_if<!std::is_convertible<U, T>::value, int>::type = 0>
   StatusOr(StatusOr<U>&& other) : code_(other.code_) {  // NOLINT
     CHECK(code_ != Status::cOK);
-    new (&error) error_type(std::move(other.error));
+    new (&error) ErrorType(std::move(other.error));
   }
 
   StatusOr& operator=(const StatusOr&) = delete;
@@ -276,17 +276,17 @@ struct [[nodiscard]] StatusOr {
 
   Code GetCode() const { return code_; }
 
-  value_type& GetValue() & {
+  ValueType& GetValue() & {
     CHECK(*this);
     return value;
   }
 
-  value_type&& GetValue() && {
+  ValueType&& GetValue() && {
     CHECK(*this);
     return std::move(value);
   }
 
-  const value_type& ValueOr(const value_type& v) const& {
+  const ValueType& ValueOr(const ValueType& v) const& {
     if (IsOK()) {
       return GetValue();
     } else {
@@ -294,7 +294,7 @@ struct [[nodiscard]] StatusOr {
     }
   }
 
-  value_type ValueOr(value_type&& v) const& {
+  ValueType ValueOr(ValueType&& v) const& {
     if (IsOK()) {
       return GetValue();
     } else {
@@ -302,7 +302,7 @@ struct [[nodiscard]] StatusOr {
     }
   }
 
-  value_type ValueOr(const T& v) && {
+  ValueType ValueOr(const T& v) && {
     if (IsOK()) {
       return std::move(*this).GetValue();
     } else {
@@ -310,7 +310,7 @@ struct [[nodiscard]] StatusOr {
     }
   }
 
-  value_type&& ValueOr(T&& v) && {
+  ValueType&& ValueOr(T&& v) && {
     if (IsOK()) {
       return std::move(*this).GetValue();
     } else {
@@ -318,20 +318,20 @@ struct [[nodiscard]] StatusOr {
     }
   }
 
-  const value_type& GetValue() const& {
+  const ValueType& GetValue() const& {
     CHECK(*this);
     return value;
   }
 
-  value_type& operator*() & { return GetValue(); }
+  ValueType& operator*() & { return GetValue(); }
 
-  value_type&& operator*() && { return std::move(GetValue()); }
+  ValueType&& operator*() && { return std::move(GetValue()); }
 
-  const value_type& operator*() const& { return GetValue(); }
+  const ValueType& operator*() const& { return GetValue(); }
 
-  value_type* operator->() { return &GetValue(); }
+  ValueType* operator->() { return &GetValue(); }
 
-  const value_type* operator->() const { return &GetValue(); }
+  const ValueType* operator->() const { return &GetValue(); }
 
   std::string Msg() const& {
     if (*this) return Status::ok_msg;
@@ -352,17 +352,17 @@ struct [[nodiscard]] StatusOr {
 
   ~StatusOr() {
     if (*this) {
-      value.~value_type();
+      value.~ValueType();
     } else {
-      error.~error_type();
+      error.~ErrorType();
     }
   }
 
  private:
   Status::Code code_;
   union {
-    value_type value;
-    error_type error;
+    ValueType value;
+    ErrorType error;
   };
 
   template <typename>
diff --git a/src/config/config.cc b/src/config/config.cc
index ef60ac16..f8929b27 100644
--- a/src/config/config.cc
+++ b/src/config/config.cc
@@ -234,7 +234,7 @@ Config::Config() {
 // The validate function would be invoked before the field was set,
 // to make sure that new value is valid.
 void Config::initFieldValidator() {
-  std::map<std::string, validate_fn> validators = {
+  std::map<std::string, ValidateFn> validators = {
       {"requirepass",
        [this](const std::string &k, const std::string &v) -> Status {
          if (v.empty() && !tokens.empty()) {
@@ -337,7 +337,7 @@ void Config::initFieldCallback() {
   };
 #endif
 
-  std::map<std::string, callback_fn> callbacks = {
+  std::map<std::string, CallbackFn> callbacks = {
       {"dir",
        [this](Server *srv, const std::string &k, const std::string &v) -> Status {
          db_dir = dir + "/db";
diff --git a/src/config/config_type.h b/src/config/config_type.h
index 7d39e0d9..84167893 100644
--- a/src/config/config_type.h
+++ b/src/config/config_type.h
@@ -35,8 +35,8 @@
 // forward declaration
 class Server;
 
-using validate_fn = std::function<Status(const std::string &, const std::string &)>;
-using callback_fn = std::function<Status(Server *, const std::string &, const std::string &)>;
+using ValidateFn = std::function<Status(const std::string &, const std::string &)>;
+using CallbackFn = std::function<Status(Server *, const std::string &, const std::string &)>;
 
 // forward declaration
 template <typename>
@@ -51,7 +51,7 @@ struct ConfigEnum {
   const int val;
 };
 
-enum configType { SingleConfig, MultiConfig };
+enum ConfigType { SingleConfig, MultiConfig };
 
 int configEnumGetValue(ConfigEnum *ce, const char *name);
 const char *configEnumGetName(ConfigEnum *ce, int val);
@@ -64,15 +64,15 @@ class ConfigField {
   virtual Status Set(const std::string &v) = 0;
   virtual Status ToNumber(int64_t *n) { return {Status::NotOK, "not supported"}; }
   virtual Status ToBool(bool *b) { return {Status::NotOK, "not supported"}; }
-  virtual configType GetConfigType() { return config_type; }
-  virtual bool IsMultiConfig() { return config_type == configType::MultiConfig; }
-  virtual bool IsSingleConfig() { return config_type == configType::SingleConfig; }
+  virtual ConfigType GetConfigType() { return config_type; }
+  virtual bool IsMultiConfig() { return config_type == ConfigType::MultiConfig; }
+  virtual bool IsSingleConfig() { return config_type == ConfigType::SingleConfig; }
 
   int line_number = 0;
   bool readonly = true;
-  validate_fn validate = nullptr;
-  callback_fn callback = nullptr;
-  configType config_type = configType::SingleConfig;
+  ValidateFn validate = nullptr;
+  CallbackFn callback = nullptr;
+  ConfigType config_type = ConfigType::SingleConfig;
 };
 
 class StringField : public ConfigField {
@@ -93,7 +93,7 @@ class MultiStringField : public ConfigField {
  public:
   MultiStringField(std::vector<std::string> *receiver, std::vector<std::string> input) : receiver_(receiver) {
     *receiver_ = std::move(input);
-    this->config_type = configType::MultiConfig;
+    this->config_type = ConfigType::MultiConfig;
   }
   ~MultiStringField() override = default;
   std::string ToString() override {
diff --git a/src/server/redis_connection.cc b/src/server/redis_connection.cc
index 61cfe98b..eb6369da 100644
--- a/src/server/redis_connection.cc
+++ b/src/server/redis_connection.cc
@@ -197,7 +197,7 @@ void Connection::UnsubscribeChannel(const std::string &channel) {
   }
 }
 
-void Connection::UnsubscribeAll(const unsubscribe_callback &reply) {
+void Connection::UnsubscribeAll(const UnsubscribeCallback &reply) {
   if (subscribe_channels_.empty()) {
     if (reply) reply("", static_cast<int>(subscribe_patterns_.size()));
     return;
@@ -234,7 +234,7 @@ void Connection::PUnsubscribeChannel(const std::string &pattern) {
   }
 }
 
-void Connection::PUnsubscribeAll(const unsubscribe_callback &reply) {
+void Connection::PUnsubscribeAll(const UnsubscribeCallback &reply) {
   if (subscribe_patterns_.empty()) {
     if (reply) reply("", static_cast<int>(subscribe_channels_.size()));
     return;
diff --git a/src/server/redis_connection.h b/src/server/redis_connection.h
index 68cfd564..814c71e1 100644
--- a/src/server/redis_connection.h
+++ b/src/server/redis_connection.h
@@ -61,14 +61,14 @@ class Connection {
   void SendFile(int fd);
   std::string ToString();
 
-  using unsubscribe_callback = std::function<void(std::string, int)>;
+  using UnsubscribeCallback = std::function<void(std::string, int)>;
   void SubscribeChannel(const std::string &channel);
   void UnsubscribeChannel(const std::string &channel);
-  void UnsubscribeAll(const unsubscribe_callback &reply = nullptr);
+  void UnsubscribeAll(const UnsubscribeCallback &reply = nullptr);
   int SubscriptionsCount();
   void PSubscribeChannel(const std::string &pattern);
   void PUnsubscribeChannel(const std::string &pattern);
-  void PUnsubscribeAll(const unsubscribe_callback &reply = nullptr);
+  void PUnsubscribeAll(const UnsubscribeCallback &reply = nullptr);
   int PSubscriptionsCount();
 
   uint64_t GetAge() const;
diff --git a/src/server/server.cc b/src/server/server.cc
index 6a777123..42c9d52b 100644
--- a/src/server/server.cc
+++ b/src/server/server.cc
@@ -52,7 +52,6 @@
 #include "version.h"
 #include "worker.h"
 
-std::atomic<int> Server::unix_time_ = {0};
 constexpr const char *REDIS_VERSION = "4.0.0";
 
 Server::Server(Engine::Storage *storage, Config *config)
@@ -623,7 +622,7 @@ void Server::delConnContext(ConnContext *c) {
 void Server::updateCachedTime() {
   time_t ret = Util::GetTimeStamp();
   if (ret == -1) return;
-  unix_time_.store(static_cast<int>(ret));
+  unix_time.store(static_cast<int>(ret));
 }
 
 int Server::IncrClientNum() {
@@ -983,10 +982,10 @@ void Server::SetLastRandomKeyCursor(const std::string &cursor) {
 }
 
 int Server::GetCachedUnixTime() {
-  if (unix_time_.load() == 0) {
-    unix_time_.store(static_cast<int>(Util::GetTimeStamp()));
+  if (unix_time.load() == 0) {
+    unix_time.store(static_cast<int>(Util::GetTimeStamp()));
   }
-  return unix_time_.load();
+  return unix_time.load();
 }
 
 void Server::GetStatsInfo(std::string *info) {
diff --git a/src/server/server.h b/src/server/server.h
index 811e32cc..675e1414 100644
--- a/src/server/server.h
+++ b/src/server/server.h
@@ -220,7 +220,7 @@ class Server {
   Stats stats;
   Engine::Storage *storage;
   std::unique_ptr<Cluster> cluster;
-  static std::atomic<int> unix_time_;
+  static inline std::atomic<int> unix_time = 0;
   std::unique_ptr<SlotMigrator> slot_migrator;
   std::unique_ptr<SlotImport> slot_import;
 
diff --git a/src/server/tls_util.h b/src/server/tls_util.h
index c2a21fd0..7b87314a 100644
--- a/src/server/tls_util.h
+++ b/src/server/tls_util.h
@@ -34,11 +34,11 @@ void InitSSL();
 using StaticSSLCTXFree = StaticFunction<decltype(SSL_CTX_free), SSL_CTX_free>;
 
 struct UniqueSSLContext : std::unique_ptr<SSL_CTX, StaticSSLCTXFree> {
-  using base_type = std::unique_ptr<SSL_CTX, StaticSSLCTXFree>;
+  using BaseType = std::unique_ptr<SSL_CTX, StaticSSLCTXFree>;
 
-  using base_type::base_type;
+  using BaseType::BaseType;
 
-  explicit UniqueSSLContext(const SSL_METHOD *method = SSLv23_method()) : base_type(SSL_CTX_new(method)) {}
+  explicit UniqueSSLContext(const SSL_METHOD *method = SSLv23_method()) : BaseType(SSL_CTX_new(method)) {}
 };
 
 UniqueSSLContext CreateSSLContext(const Config *config, const SSL_METHOD *method = SSLv23_method());
@@ -46,13 +46,13 @@ UniqueSSLContext CreateSSLContext(const Config *config, const SSL_METHOD *method
 using StaticSSLFree = StaticFunction<decltype(SSL_free), SSL_free>;
 
 struct UniqueSSL : std::unique_ptr<SSL, StaticSSLFree> {
-  using base_type = std::unique_ptr<SSL, StaticSSLFree>;
+  using BaseType = std::unique_ptr<SSL, StaticSSLFree>;
 
-  using base_type::base_type;
+  using BaseType::BaseType;
 
   UniqueSSL() = default;
 
-  explicit UniqueSSL(SSL_CTX *ctx) : base_type(SSL_new(ctx)) {}
+  explicit UniqueSSL(SSL_CTX *ctx) : BaseType(SSL_new(ctx)) {}
 };
 
 struct SSLErrors {
diff --git a/tests/cppunit/status_test.cc b/tests/cppunit/status_test.cc
index 56e440c3..5c800c9e 100644
--- a/tests/cppunit/status_test.cc
+++ b/tests/cppunit/status_test.cc
@@ -171,10 +171,10 @@ TEST(StatusOr, Size) {
     std::string a, b;
   };
 
-  static_assert(!StatusOr<char>::error_type::inplace);
-  static_assert(!StatusOr<int>::error_type::inplace);
-  static_assert(StatusOr<std::string>::error_type::inplace);
-  static_assert(StatusOr<A>::error_type::inplace);
+  static_assert(!StatusOr<char>::ErrorType::inplace);
+  static_assert(!StatusOr<int>::ErrorType::inplace);
+  static_assert(StatusOr<std::string>::ErrorType::inplace);
+  static_assert(StatusOr<A>::ErrorType::inplace);
 
   struct B1 {
     char a;
diff --git a/tests/cppunit/string_reply_test.cc b/tests/cppunit/string_reply_test.cc
index 687d9ee5..7604063f 100644
--- a/tests/cppunit/string_reply_test.cc
+++ b/tests/cppunit/string_reply_test.cc
@@ -26,26 +26,26 @@ class StringReplyTest : public testing::Test {
  protected:
   static void SetUpTestCase() {
     for (int i = 0; i < 100000; i++) {
-      values_.emplace_back("values" + std::to_string(i));
+      values.emplace_back("values" + std::to_string(i));
     }
   }
-  static void TearDownTestCase() { values_.clear(); }
-  static std::vector<std::string> values_;
+  static void TearDownTestCase() { values.clear(); }
+  static std::vector<std::string> values;
 
   void SetUp() override {}
   void TearDown() override {}
 };
 
-std::vector<std::string> StringReplyTest::values_;
+std::vector<std::string> StringReplyTest::values;
 
 TEST_F(StringReplyTest, MultiBulkString) {
-  std::string result = Redis::MultiBulkString(values_);
+  std::string result = Redis::MultiBulkString(values);
   ASSERT_EQ(result.length(), 13 * 10 + 14 * 90 + 15 * 900 + 17 * 9000 + 18 * 90000 + 9);
 }
 
 TEST_F(StringReplyTest, BulkString) {
-  std::string result = "*" + std::to_string(values_.size()) + CRLF;
-  for (const auto &v : values_) {
+  std::string result = "*" + std::to_string(values.size()) + CRLF;
+  for (const auto &v : values) {
     result += Redis::BulkString(v);
   }