From 719368ae2541bf3fa9025a445a071f569db3ec97 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 4 May 2026 17:20:36 +0000 Subject: [PATCH] fix: Apply pre-commit and clang-tidy fixes (formatting, braces, naming) Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/a872065b-cdb8-47a7-8acb-3ece056594ca Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com> --- include/xrpl/beast/utility/temp_dir.h | 6 +++--- src/test/app/GRPCServerTLS_test.cpp | 6 ++++-- src/xrpld/app/misc/SHAMapStoreImp.cpp | 6 ++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/xrpl/beast/utility/temp_dir.h b/include/xrpl/beast/utility/temp_dir.h index c0bd07881f..36d6bfe0d5 100644 --- a/include/xrpl/beast/utility/temp_dir.h +++ b/include/xrpl/beast/utility/temp_dir.h @@ -17,9 +17,7 @@ namespace beast { checking for existence. */ inline std::filesystem::path -uniqueRandomPath( - std::filesystem::path const& base, - std::size_t maxAttempts = 100) +uniqueRandomPath(std::filesystem::path const& base, std::size_t maxAttempts = 100) { std::random_device rd; for (std::size_t attempt = 0; attempt < maxAttempts; ++attempt) @@ -30,8 +28,10 @@ uniqueRandomPath( std::error_code ec; bool const exists = std::filesystem::exists(candidate, ec); if (ec) + { throw std::runtime_error( "Unable to check path '" + candidate.string() + "': " + ec.message()); + } if (!exists) return candidate; } diff --git a/src/test/app/GRPCServerTLS_test.cpp b/src/test/app/GRPCServerTLS_test.cpp index 7025ed7b54..b5c47d5936 100644 --- a/src/test/app/GRPCServerTLS_test.cpp +++ b/src/test/app/GRPCServerTLS_test.cpp @@ -260,8 +260,8 @@ public: { auto tmpDir = std::filesystem::temp_directory_path(); std::random_device rd; - constexpr std::size_t maxAttempts = 100; - for (std::size_t attempt = 0; attempt < maxAttempts; ++attempt) + constexpr std::size_t kMAX_ATTEMPTS = 100; + for (std::size_t attempt = 0; attempt < kMAX_ATTEMPTS; ++attempt) { std::ostringstream oss; oss << kCERTS_DIR_PREFIX << std::hex << std::setfill('0') << std::setw(8) << rd(); @@ -269,8 +269,10 @@ public: std::error_code ec; bool const exists = std::filesystem::exists(tempDir_, ec); if (ec) + { throw std::runtime_error( "Unable to check path '" + tempDir_.string() + "': " + ec.message()); + } if (!exists) break; tempDir_.clear(); diff --git a/src/xrpld/app/misc/SHAMapStoreImp.cpp b/src/xrpld/app/misc/SHAMapStoreImp.cpp index 7492c39131..10d0fe23e6 100644 --- a/src/xrpld/app/misc/SHAMapStoreImp.cpp +++ b/src/xrpld/app/misc/SHAMapStoreImp.cpp @@ -477,8 +477,8 @@ SHAMapStoreImp::makeBackendRotating(std::string path) { std::filesystem::path const p = get(section, "path"); std::random_device rd; - constexpr std::size_t maxAttempts = 100; - for (std::size_t attempt = 0; attempt < maxAttempts; ++attempt) + constexpr std::size_t kMAX_ATTEMPTS = 100; + for (std::size_t attempt = 0; attempt < kMAX_ATTEMPTS; ++attempt) { std::ostringstream oss; oss << std::hex << std::setfill('0') << std::setw(8) << rd() << std::setw(8) << rd(); @@ -487,9 +487,11 @@ SHAMapStoreImp::makeBackendRotating(std::string path) std::error_code existsEc; bool const candidateExists = std::filesystem::exists(candidate, existsEc); if (existsEc) + { Throw( "Unable to check rotating backend path '" + candidate.string() + "': " + existsEc.message()); + } if (!candidateExists) { newPath = candidate;