chore: Enable most bugprone checks#7643
Conversation
b238811 to
38a6a4e
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #7643 +/- ##
=======================================
Coverage 82.0% 82.0%
=======================================
Files 1007 1007
Lines 76888 76875 -13
Branches 8971 8972 +1
=======================================
- Hits 63042 63033 -9
+ Misses 13837 13833 -4
Partials 9 9
🚀 New features to boost your workflow:
|
|
This PR has conflicts, please resolve them in order for the PR to be reviewed. |
38a6a4e to
1597efd
Compare
|
All conflicts have been resolved. Assigned reviewers can now start or resume their review. |
a121a3e to
440ad09
Compare
440ad09 to
99ad457
Compare
99ad457 to
df7a6df
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the repository’s .clang-tidy configuration to enable most bugprone-* checks and applies a set of small refactors / annotations across core code and tests to satisfy (or intentionally suppress) the newly enabled diagnostics.
Changes:
- Enable most
bugprone-*clang-tidy checks by removing several per-check exclusions from.clang-tidy. - Refactor a number of “assignment-in-condition”, duplicated-branch, and empty-branch patterns into clearer control flow.
- Add targeted
NOLINTNEXTLINE(...)suppressions in tests where deterministic behavior is intentional (e.g., fixed RNG seeds, float loop counters).
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/xrpld/rpc/detail/PathRequestManager.cpp | Removes assignment-in-if pattern when sending path_find updates. |
| src/xrpld/rpc/detail/Pathfinder.cpp | Refactors path ranking comparisons and replaces empty branches with continue/simplified flow. |
| src/xrpld/core/detail/Config.cpp | Simplifies validators file existence/type validation condition. |
| src/tests/libxrpl/tx/AccountSet.cpp | Adds NOLINTNEXTLINE for float loop counter in a test. |
| src/test/unit_test/SuiteJournal.h | Simplifies switch handling to avoid redundant default/break pattern. |
| src/test/rpc/LedgerEntry_test.cpp | Removes duplicated returns by using intentional fallthrough for UInt32/UInt64 cases. |
| src/test/nodestore/TestBase.h | Removes redundant switch case returning same default value. |
| src/test/csf/Sim.h | Adds a bugprone-random-generator-seed suppression comment for deterministic behavior. |
| src/test/consensus/LedgerTrie_test.cpp | Adds bugprone-random-generator-seed suppression for fixed-seed RNG in test. |
| src/test/app/XChain_test.cpp | Removes redundant if/else branches; adds RNG seed suppression in sim test. |
| src/test/app/NFTokenBurn_test.cpp | Adds RNG seed suppression for deterministic test behavior. |
| src/test/app/MPToken_test.cpp | Combines feature-flag conditional branches with identical expectations. |
| src/test/app/LoanBroker_test.cpp | Removes assignment-in-if pattern by splitting assignment and condition. |
| src/test/app/AccountSet_test.cpp | Adds NOLINTNEXTLINE for float loop counter in a test. |
| src/libxrpl/tx/transactors/dex/AMMWithdraw.cpp | Combines two flag branches with identical validation logic. |
| src/libxrpl/nodestore/backend/RocksDBFactory.cpp | Replaces std::bit_cast pointer casts with reinterpret_cast for RocksDB slices. |
| src/libxrpl/ledger/helpers/TokenHelpers.cpp | Simplifies conditional clearing of amounts with short-circuit logic. |
| src/libxrpl/conditions/Fulfillment.cpp | Removes unreachable break statements after return. |
| src/libxrpl/conditions/Condition.cpp | Removes unreachable code in unsupported-type switch cases. |
| include/xrpl/protocol/detail/token_errors.h | Removes redundant switch case where default already returns same string. |
| include/xrpl/config/BasicConfig.h | Removes assignment-in-if by separating assignment from condition. |
| .clang-tidy | Enables more bugprone-* checks by removing multiple exclusions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
High Level Overview of Change
This enables most
bugrpone-checks, except where it might be difficult to fix, and they probably better be addressed one by one.Context of Change
API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)