Sponsored Content
Skip to content

refactor: Enable clang-tidy readability-identifier-naming check - #6571

Merged
bthomee merged 66 commits into
XRPLF:developfrom
godexsoft:refactor/naming-variables-style
May 3, 2026
Merged

refactor: Enable clang-tidy readability-identifier-naming check#6571
bthomee merged 66 commits into
XRPLF:developfrom
godexsoft:refactor/naming-variables-style

Conversation

@godexsoft

@godexsoft godexsoft commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

High Level Overview of Change

This PR enables clang-tidy readability-identifier-naming changing a lot of code in the process.
Many places are hard to fix so NOLINTs were added strategically.

API Impact

No impact.

@godexsoft godexsoft added the DraftRunCI Normally CI does not run on draft PRs. This opts in. label Mar 17, 2026
Comment thread include/xrpl/basics/spinlock.h Outdated
@godexsoft godexsoft changed the title refactor: Variable naming style refactor: Enable clang-tidy readability-identifier-naming Mar 18, 2026
Copilot AI review requested due to automatic review settings May 2, 2026 17:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copilot AI review requested due to automatic review settings May 2, 2026 19:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copilot AI review requested due to automatic review settings May 2, 2026 20:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@mathbunnyru mathbunnyru left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this is great, but I left some nits.
Great improvement for the code uniformity 👍
Feel free to ignore/resolve, or whatever you think is best.

* MPT Support: ${field['mpt_support']}
% endif
% if field['requirement'] == 'soeREQUIRED':
% if field['requirement'] == 'SoeRequired':

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case, please check the old name no longer appears in the code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not only in code.. it does not appear in anything at all :)

static state_t state;
std::scoped_lock const lock(state.mutex);
return {state.dist(state.gen), state.dist(state.gen)};
static StateT kSTATE;

@mathbunnyru mathbunnyru May 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also name statics like this in Clio?
It's not the same as a constant expression, but uses the same naming pattern, would be great to make them different

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and we can in newer clang-tidy but sadly we do the same in clio because in 21 we can't just yet. I will change them later when we can do it correctly for constexpr too

template <class T>
SharedIntrusive<T>::SharedIntrusive(SharedIntrusive&& rhs) : ptr_{rhs.unsafeExchange(nullptr)}
SharedIntrusive<T>::SharedIntrusive(SharedIntrusive&& rhs)
: ptr_{std::move(rhs).unsafeExchange(nullptr)}

@mathbunnyru mathbunnyru May 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::move isn't just renaming, please, check changes in this file are intended and correct

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes these are intended. Remember that changing any code leads to new findings for already enabled checks.. so this pr does a lot more than just renaming tbh

switch (action)
{
case noop:
case Noop:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe NoOp?

Comment thread include/xrpl/basics/Log.h Outdated
enum LogSeverity {
lsINVALID = -1, // used to indicate an invalid severity
lsTRACE = 0, // Very low-level progress information, details inside
LsInvalid = -1, // used to indicate an invalid severity

@mathbunnyru mathbunnyru May 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be LSInvalid and so on, because L and S are parts of different words

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll rename for now but really we should remove this deprecated enum and use beast::severities::Severity instead as the comment suggested.

Comment thread include/xrpl/protocol/STAmount.h Outdated

constexpr static int cMinOffset = -96;
constexpr static int cMaxOffset = 80;
constexpr static int kC_MIN_OFFSET = -96;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should be just kMIN_OFFSET.
Please, fix here and search for similar pattern

template <class... Args>
void
emplace_back(Args&&... args);
emplaceBack(Args&&... args);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have an opinion about places like this, to be honest.
But it might break some template code which checks for emplace_back to be available, and hoping for either std::vector or STArray

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually kept some of the ones that you describe. Not sure this one is tbh., will check. I mostly went by code compiling and tests passing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this one i see no evidence that we used it in some sort of concept or similar so i think it's fine. The name itself is also fine as it conforms to clang-tidy settings. For things that definitely needed to stay i have systematically been adding exceptions but these are mostly free standing functions.

Comment thread src/xrpld/rpc/Request.h
@@ -1,53 +0,0 @@
#pragma once

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file deletion on purpose?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hell no. How did you even spot that? 😅

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so this and some other file was deleted because it's not used anywhere in the codebase. So this is fine 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hell no. How did you even spot that? 😅

From the phone it looked like it was deleting just the '#pragma once' line so i was surprised :)

Comment thread .clang-tidy
Comment on lines +164 to +165
readability-identifier-naming.UnionCase: CamelCase
readability-identifier-naming.EnumCase: CamelCase

@mathbunnyru mathbunnyru May 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe let's keep the entries sorted?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are actually grouped logically, not alphabetically. And it's the same in Clio so i think it's fine as is for now

Copilot AI review requested due to automatic review settings May 3, 2026 01:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@godexsoft godexsoft added the Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. label May 3, 2026
Comment thread .clang-tidy
misc-include-cleaner.IgnoreHeaders: ".*/(detail|impl)/.*;.*fwd\\.h(pp)?;time.h;stdlib.h;sqlite3.h;netinet/in\\.h;sys/resource\\.h;sys/sysinfo\\.h;linux/sysinfo\\.h;__chrono/.*;bits/.*;_abort\\.h;boost/uuid/uuid_hash.hpp;boost/beast/core/flat_buffer\\.hpp;boost/beast/http/field\\.hpp;boost/beast/http/dynamic_body\\.hpp;boost/beast/http/message\\.hpp;boost/beast/http/read\\.hpp;boost/beast/http/write\\.hpp;openssl/obj_mac\\.h"
#
HeaderFilterRegex: '^.*/(test|xrpl|xrpld)/.*\.(h|hpp)$'
HeaderFilterRegex: '^.*/(test|xrpl|xrpld)/.*\.(h|hpp|ipp)$'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should tests be added here too (the one from src/tests/; the tests/ can probably be skipped)?

There are currently no header files in it, but as tests are migrated from src/test/ to src/tests/they might start showing up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in the future possibly if we need them 👍

@bthomee bthomee changed the title refactor: Enable clang-tidy readability-identifier-naming refactor: Enable clang-tidy readability-identifier-naming check May 3, 2026
@bthomee
bthomee added this pull request to the merge queue May 3, 2026
Merged via the queue into XRPLF:develop with commit 8995564 May 3, 2026
3 checks passed
@mvadari mvadari added this to the 3.2.0 milestone May 20, 2026
beartec-jpg pushed a commit to beartec-jpg/FalconLedger that referenced this pull request Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants