This is an automated email from the ASF dual-hosted git repository.
xyz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-client-cpp.git
The following commit(s) were added to refs/heads/main by this push:
new e290658 Fix clang tidy errors not detected as well as the errors
(#544)
e290658 is described below
commit e290658827ca7b835e5fe7570722605727cc67c5
Author: Yunze Xu <[email protected]>
AuthorDate: Wed Mar 4 21:48:13 2026 +0800
Fix clang tidy errors not detected as well as the errors (#544)
---
.github/workflows/ci-pr-validation.yaml | 20 ++++++++++----------
build-support/run_clang_tidy.sh | 6 ++++--
lib/ClientConnection.cc | 2 +-
tests/TlsNegotiationTest.cc | 4 ++--
4 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/.github/workflows/ci-pr-validation.yaml
b/.github/workflows/ci-pr-validation.yaml
index 8d14e7d..b5a0973 100644
--- a/.github/workflows/ci-pr-validation.yaml
+++ b/.github/workflows/ci-pr-validation.yaml
@@ -92,9 +92,11 @@ jobs:
- name: Restore vcpkg installed cache
uses: actions/cache@v4
+ id: vcpkg-cache
+ if: always() && steps.vcpkg-cache.outputs.cache-hit != 'true'
with:
path: build/vcpkg_installed
- key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json',
'CMakeLists.txt', 'vcpkg-triplets/**') }}
+ key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
restore-keys: vcpkg-${{ runner.os }}-
- name: Build the project
@@ -126,11 +128,13 @@ jobs:
- name: Restore vcpkg installed cache
uses: actions/cache@v4
+ id: vcpkg-cache
+ if: always() && steps.vcpkg-cache.outputs.cache-hit != 'true'
with:
path: |
build/vcpkg_installed
build-boost-asio/vcpkg_installed
- key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json',
'CMakeLists.txt', 'vcpkg-triplets/**') }}
+ key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
restore-keys: vcpkg-${{ runner.os }}-
- name: Build core libraries
@@ -168,11 +172,6 @@ jobs:
cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON
-DBUILD_PERF_TOOLS=ON
cmake --build build -j8
- - name: Verify custom vcpkg installation
- run: |
- mv vcpkg /tmp/vcpkg-custom
- cmake -B build-2 -DINTEGRATE_VCPKG=ON
-DCMAKE_TOOLCHAIN_FILE="/tmp/vcpkg-custom/scripts/buildsystems/vcpkg.cmake"
-
cpp20-build:
name: Build with the C++20 standard
needs: lint
@@ -229,7 +228,7 @@ jobs:
- name: Restore vcpkg and its artifacts.
uses: actions/cache@v4
id: vcpkg-cache
- continue-on-error: true
+ if: always() && steps.vcpkg-cache.outputs.cache-hit != 'true'
with:
path: |
${{ github.workspace }}/vcpkg_installed
@@ -238,7 +237,6 @@ jobs:
key: ${{ runner.os }}-${{ matrix.triplet }}-vcpkg-${{
hashFiles('vcpkg.json') }}
restore-keys: |
${{ runner.os }}-${{ matrix.triplet }}-vcpkg-
- save-always: true
- name: Get vcpkg(windows)
if: ${{ runner.os == 'Windows' && steps.vcpkg-cache.outputs.cache-hit
!= 'true' }}
@@ -387,9 +385,11 @@ jobs:
- name: Restore vcpkg installed cache
uses: actions/cache@v4
+ id: vcpkg-cache
+ if: always() && steps.vcpkg-cache.outputs.cache-hit != 'true'
with:
path: build-osx/vcpkg_installed
- key: vcpkg-${{ runner.os }}-arm64-${{ hashFiles('vcpkg.json',
'CMakeLists.txt', 'vcpkg-triplets/**') }}
+ key: vcpkg-${{ runner.os }}-arm64-${{ hashFiles('vcpkg.json') }}
restore-keys: vcpkg-${{ runner.os }}-arm64-
- name: Build libraries
diff --git a/build-support/run_clang_tidy.sh b/build-support/run_clang_tidy.sh
index d6e068b..3341930 100755
--- a/build-support/run_clang_tidy.sh
+++ b/build-support/run_clang_tidy.sh
@@ -34,8 +34,10 @@ SCRIPT=$(which run-clang-tidy)
set +e
nproc
if [[ $? == 0 ]]; then
- python3 $SCRIPT -p build -j$(nproc) $(cat files.txt)
+ NUM_THREADS=$(nproc)
else
- python3 $SCRIPT -p build -j8 $(cat files.txt)
+ NUM_THREADS=8
fi
+set -e
+python3 $SCRIPT -p build -j$NUM_THREADS $(cat files.txt)
rm -f files.txt
diff --git a/lib/ClientConnection.cc b/lib/ClientConnection.cc
index 8665a7e..0a850ed 100644
--- a/lib/ClientConnection.cc
+++ b/lib/ClientConnection.cc
@@ -597,7 +597,7 @@ void ClientConnection::tcpConnectAsync() {
auto weakSelf = weak_from_this();
resolver_->async_resolve(service_url.host(),
std::to_string(service_url.port()),
- [weakSelf](const ASIO_ERROR& err,
tcp::resolver::results_type results) {
+ [weakSelf](auto err, const auto& results) {
auto self = weakSelf.lock();
if (self) {
self->handleResolve(err, results);
diff --git a/tests/TlsNegotiationTest.cc b/tests/TlsNegotiationTest.cc
index 64f956d..84dd55e 100644
--- a/tests/TlsNegotiationTest.cc
+++ b/tests/TlsNegotiationTest.cc
@@ -135,7 +135,7 @@ TEST(TlsNegotiationTest, testTls12) {
// It will fail to create producer because mock server doesn't speak
Pulsar,
// but we only care about the handshake.
Producer producer;
- client.createProducerAsync("topic", [](Result, Producer) {});
+ client.createProducerAsync("topic", [](auto, const auto&) {});
// Wait for handshake
ASSERT_TRUE(handshakeFuture.get());
@@ -170,7 +170,7 @@ TEST(TlsNegotiationTest, testTls13) {
Client client(serviceUrl, config);
- client.createProducerAsync("topic", [](Result, Producer) {});
+ client.createProducerAsync("topic", [](auto, const auto&) {});
ASSERT_TRUE(handshakeFuture.get());