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/kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new 90c5d1c40 ci: update clang-format from 14 to 18 (#3221)
90c5d1c40 is described below
commit 90c5d1c407d341464cd72433cd1b38056865f658
Author: Twice <[email protected]>
AuthorDate: Wed Oct 8 19:02:34 2025 +0800
ci: update clang-format from 14 to 18 (#3221)
Recently, we’ve seen many PRs fail the CI check because they were
formatted with a newer version of clang-format, which differs from the
one used in CI (clang-format-14). Clang-format 14 is a relatively old
version, especially on newer Linux distributions.
In this PR, we switch to using clang-format 18. We didn’t choose a
higher version because clang-format 18 is the latest one available in
Ubuntu 24.04’s official apt repository. Although LLVM provides newer
versions through its own apt source, we’re upgrading to 18 for now to
make it easier for developers to install and use.
---
.github/workflows/kvrocks.yaml | 8 ++++----
src/cli/main.cc | 10 ++++------
src/commands/commander.cc | 5 +----
src/common/cron.h | 2 +-
src/common/status.h | 2 +-
src/common/string_util.h | 3 +--
src/search/interval.h | 3 +--
src/search/plan_executor.cc | 4 ++--
tests/cppunit/config_test.cc | 18 ++++++------------
x.py | 2 +-
10 files changed, 22 insertions(+), 35 deletions(-)
diff --git a/.github/workflows/kvrocks.yaml b/.github/workflows/kvrocks.yaml
index 79800b2be..ca4f06a11 100644
--- a/.github/workflows/kvrocks.yaml
+++ b/.github/workflows/kvrocks.yaml
@@ -66,7 +66,7 @@ jobs:
name: Lint and check code
needs: [precondition]
if: ${{ needs.precondition.outputs.docs_only != 'true' }}
- runs-on: ubuntu-22.04
+ runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: apache/skywalking-eyes/[email protected]
@@ -79,10 +79,10 @@ jobs:
- name: Prepare Dependencies
run: |
sudo apt update
- sudo apt install -y clang-format-14 clang-tidy-14
+ sudo apt install -y clang-format-18 clang-tidy-14
- name: Check with clang-format
id: check-format
- run: ./x.py check format --clang-format-path clang-format-14
+ run: ./x.py check format --clang-format-path clang-format-18
- name: Check with clang-tidy
run: |
./x.py build --skip-build
@@ -92,7 +92,7 @@ jobs:
- name: Prepare format patch
if: always() && steps.check-format.outcome != 'success'
run: |
- ./x.py format --clang-format-path clang-format-14
+ ./x.py format --clang-format-path clang-format-18
git diff -p > clang-format.patch
cat clang-format.patch
- name: Upload format patch
diff --git a/src/cli/main.cc b/src/cli/main.cc
index 88b4f4302..6ad03c03e 100644
--- a/src/cli/main.cc
+++ b/src/cli/main.cc
@@ -62,12 +62,10 @@ struct NewOpt {
static void PrintUsage(const char *program) {
std::cout << program << " implements the Redis protocol based on rocksdb" <<
std::endl
<< "Usage:" << std::endl
- << std::left << new_opt << "-c, --config <filename>"
- << "set config file to <filename>, or `-` for stdin" << std::endl
- << new_opt << "-v, --version"
- << "print version information" << std::endl
- << new_opt << "-h, --help"
- << "print this help message" << std::endl
+ << std::left << new_opt << "-c, --config <filename>" << "set
config file to <filename>, or `-` for stdin"
+ << std::endl
+ << new_opt << "-v, --version" << "print version information" <<
std::endl
+ << new_opt << "-h, --help" << "print this help message" <<
std::endl
<< new_opt << "--<config-key> <config-value>"
<< "overwrite specific config option <config-key> to
<config-value>" << std::endl;
}
diff --git a/src/commands/commander.cc b/src/commands/commander.cc
index 8ef7ca33e..ec62a1c5e 100644
--- a/src/commands/commander.cc
+++ b/src/commands/commander.cc
@@ -99,10 +99,7 @@ StatusOr<std::vector<int>>
CommandTable::GetKeysFromCommand(const CommandAttribu
[&](const std::vector<std::string> &, CommandKeyRange key_range) {
key_range.ForEachKeyIndex([&](int i) { key_indexes.push_back(i); },
cmd_tokens.size());
},
- cmd_tokens,
- [&](const auto &) {
- status = {Status::NotOK, "The command has no key arguments"};
- });
+ cmd_tokens, [&](const auto &) { status = {Status::NotOK, "The command
has no key arguments"}; });
if (!status) {
return status;
diff --git a/src/common/cron.h b/src/common/cron.h
index ede6231be..920c25931 100644
--- a/src/common/cron.h
+++ b/src/common/cron.h
@@ -36,7 +36,7 @@ struct CronPattern {
struct Interval {
int interval;
- }; // */n
+ }; // */n
struct Any {}; // *
using Numbers = std::vector<std::variant<Number, Range>>; // 1,2,3-6,7
diff --git a/src/common/status.h b/src/common/status.h
index e88e250c2..3426d7210 100644
--- a/src/common/status.h
+++ b/src/common/status.h
@@ -181,7 +181,7 @@ struct StringInStatusOr<T, std::enable_if_t<sizeof(T) <
sizeof(std::string)>> :
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
- : BaseType((typename StringInStatusOr<U>::BaseType &&)(std::move(v))) {}
+ : BaseType((typename StringInStatusOr<U>::BaseType&&)(std::move(v))) {}
StringInStatusOr(const StringInStatusOr& v) = delete;
diff --git a/src/common/string_util.h b/src/common/string_util.h
index 9149b2f60..88232873a 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -80,8 +80,7 @@ std::string StringJoin(const T &con, F &&f, std::string_view
sep = ", ") {
template <typename T>
std::string StringJoin(const T &con, std::string_view sep = ", ") {
- return StringJoin(
- con, [](const auto &v) -> decltype(auto) { return v; }, sep);
+ return StringJoin(con, [](const auto &v) -> decltype(auto) { return v; },
sep);
}
} // namespace util
diff --git a/src/search/interval.h b/src/search/interval.h
index efe462b40..c27573a81 100644
--- a/src/search/interval.h
+++ b/src/search/interval.h
@@ -113,8 +113,7 @@ struct IntervalSet {
std::string ToString() const {
if (IsEmpty()) return "empty set";
- return util::StringJoin(
- intervals, [](const auto &i) { return Interval(i.first,
i.second).ToString(); }, " or ");
+ return util::StringJoin(intervals, [](const auto &i) { return
Interval(i.first, i.second).ToString(); }, " or ");
}
friend std::ostream &operator<<(std::ostream &os, const IntervalSet &is) {
return os << is.ToString(); }
diff --git a/src/search/plan_executor.cc b/src/search/plan_executor.cc
index afb2de03f..07d98f437 100644
--- a/src/search/plan_executor.cc
+++ b/src/search/plan_executor.cc
@@ -162,8 +162,8 @@ ExecutorContext::ExecutorContext(PlanOperator *op,
engine::Storage *storage)
visitor.Transform(root);
}
-auto ExecutorContext::Retrieve(engine::Context &ctx, RowType &row, const
FieldInfo *field) const
- -> StatusOr<ValueType> { // NOLINT
+auto ExecutorContext::Retrieve(engine::Context &ctx, RowType &row,
+ const FieldInfo *field) const ->
StatusOr<ValueType> { // NOLINT
if (auto iter = row.fields.find(field); iter != row.fields.end()) {
return iter->second;
}
diff --git a/tests/cppunit/config_test.cc b/tests/cppunit/config_test.cc
index 8bd7bbf6e..f339a2ae0 100644
--- a/tests/cppunit/config_test.cc
+++ b/tests/cppunit/config_test.cc
@@ -147,12 +147,9 @@ TEST(Config, GetRenameCommand) {
unlink(path);
std::ofstream output_file(path, std::ios::out);
- output_file << "rename-command KEYS KEYS_NEW"
- << "\n";
- output_file << "rename-command GET GET_NEW"
- << "\n";
- output_file << "rename-command SET SET_NEW"
- << "\n";
+ output_file << "rename-command KEYS KEYS_NEW" << "\n";
+ output_file << "rename-command GET GET_NEW" << "\n";
+ output_file << "rename-command SET SET_NEW" << "\n";
output_file.close();
redis::CommandTable::Reset();
Config config;
@@ -172,12 +169,9 @@ TEST(Config, Rewrite) {
unlink(path);
std::ofstream output_file(path, std::ios::out);
- output_file << "rename-command KEYS KEYS_NEW"
- << "\n";
- output_file << "rename-command GET GET_NEW"
- << "\n";
- output_file << "rename-command SET SET_NEW"
- << "\n";
+ output_file << "rename-command KEYS KEYS_NEW" << "\n";
+ output_file << "rename-command GET GET_NEW" << "\n";
+ output_file << "rename-command SET SET_NEW" << "\n";
output_file.close();
redis::CommandTable::Reset();
diff --git a/x.py b/x.py
index 35b5936fd..69681e647 100755
--- a/x.py
+++ b/x.py
@@ -29,7 +29,7 @@ from typing import List, Any, Optional, IO, Tuple
from shutil import which
CMAKE_REQUIRE_VERSION = (3, 16, 0)
-CLANG_FORMAT_REQUIRED_VERSION = (12, 0, 0)
+CLANG_FORMAT_REQUIRED_VERSION = (18, 0, 0)
CLANG_TIDY_REQUIRED_VERSION = (12, 0, 0)
GOLANGCI_LINT_REQUIRED_VERSION = (2, 5, 0)