refactor: Enable clang-tidy readability-identifier-naming check - #6571
Conversation
readability-identifier-naming
mathbunnyru
left a comment
There was a problem hiding this comment.
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': |
There was a problem hiding this comment.
Just in case, please check the old name no longer appears in the code
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)} |
There was a problem hiding this comment.
std::move isn't just renaming, please, check changes in this file are intended and correct
There was a problem hiding this comment.
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: |
| 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 |
There was a problem hiding this comment.
These should be LSInvalid and so on, because L and S are parts of different words
There was a problem hiding this comment.
I'll rename for now but really we should remove this deprecated enum and use beast::severities::Severity instead as the comment suggested.
|
|
||
| constexpr static int cMinOffset = -96; | ||
| constexpr static int cMaxOffset = 80; | ||
| constexpr static int kC_MIN_OFFSET = -96; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
| @@ -1,53 +0,0 @@ | |||
| #pragma once | |||
There was a problem hiding this comment.
Is this file deletion on purpose?
There was a problem hiding this comment.
Hell no. How did you even spot that? 😅
There was a problem hiding this comment.
Ok so this and some other file was deleted because it's not used anywhere in the codebase. So this is fine 👍
There was a problem hiding this comment.
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 :)
| readability-identifier-naming.UnionCase: CamelCase | ||
| readability-identifier-naming.EnumCase: CamelCase |
There was a problem hiding this comment.
Maybe let's keep the entries sorted?
There was a problem hiding this comment.
They are actually grouped logically, not alphabetically. And it's the same in Clio so i think it's fine as is for now
| 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)$' |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I think in the future possibly if we need them 👍
readability-identifier-namingreadability-identifier-naming check
High Level Overview of Change
This PR enables clang-tidy
readability-identifier-namingchanging a lot of code in the process.Many places are hard to fix so NOLINTs were added strategically.
API Impact
No impact.