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>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-04 17:20:36 +00:00
committed by GitHub
parent 3e372656d3
commit 719368ae25
3 changed files with 11 additions and 7 deletions

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -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<std::runtime_error>(
"Unable to check rotating backend path '" + candidate.string() +
"': " + existsEc.message());
}
if (!candidateExists)
{
newPath = candidate;