Sponsored Content
Skip to content

chore: Enable clang-tidy bugprone-optional-value-conversion check - #6470

Merged
bthomee merged 5 commits into
XRPLF:developfrom
godexsoft:chore/clang-tidy-checks-optional-value-conversion
Mar 10, 2026
Merged

chore: Enable clang-tidy bugprone-optional-value-conversion check#6470
bthomee merged 5 commits into
XRPLF:developfrom
godexsoft:chore/clang-tidy-checks-optional-value-conversion

Conversation

@godexsoft

Copy link
Copy Markdown
Contributor

High Level Overview of Change

This PR enables clang-tidy bugprone-optional-value-conversion check.

Context of Change

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Performance (increase or change in throughput and/or latency)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)
  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)
  • Release

API Impact

No impact.

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

@godexsoft godexsoft added Trivial Simple change with minimal effect, or already tested. Only needs one approval. DraftRunCI Normally CI does not run on draft PRs. This opts in. labels Mar 4, 2026
@codecov

codecov Bot commented Mar 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.8%. Comparing base (1a7d67c) to head (305478c).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #6470     +/-   ##
=========================================
- Coverage     79.8%   79.8%   -0.0%     
=========================================
  Files          862     862             
  Lines        67875   67875             
  Branches      7551    7552      +1     
=========================================
- Hits         54194   54188      -6     
- Misses       13681   13687      +6     
Files with missing lines Coverage Δ
src/libxrpl/protocol/Permissions.cpp 100.0% <100.0%> (ø)
src/xrpld/rpc/detail/DeliveredAmount.cpp 86.7% <100.0%> (ø)
src/xrpld/rpc/handlers/Simulate.cpp 100.0% <100.0%> (ø)

... and 5 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Pull request overview

Enables the clang-tidy bugprone-optional-value-conversion check and updates a handful of call/return sites to avoid implicit conversions via dereferenced std::optional values.

Changes:

  • Enable bugprone-optional-value-conversion in .clang-tidy.
  • Replace return *opt; / passing *opt with returning/passing the std::optional directly in a few locations.
  • Minor test cleanups to match the new clang-tidy rule.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.clang-tidy Enables bugprone-optional-value-conversion (and removes it from the “disabled/problematic checks” comment list).
src/xrpld/rpc/handlers/Simulate.cpp Return the std::optional<Json::Value> error directly instead of converting via *error.
src/xrpld/rpc/detail/DeliveredAmount.cpp Return the std::optional<STAmount> from TxMeta directly instead of converting via *deliveredAmount.
src/libxrpl/protocol/Permissions.cpp Return std::optional<std::string> directly rather than converting from *granular.
src/test/app/ValidatorList_test.cpp Pass std::optional<PublicKey> directly to ValidatorList::load rather than *localSigningPublic.
src/test/app/PayStrand_test.cpp Return existing optionals directly inside helper lambdas (avoids value-to-optional conversion from dereference).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@godexsoft
godexsoft marked this pull request as ready for review March 9, 2026 13:14
@godexsoft godexsoft removed the DraftRunCI Normally CI does not run on draft PRs. This opts in. label Mar 9, 2026

@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.

nit: I would probably add .has_value() one line above of each statement, but this is already good as is

@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 Mar 9, 2026
@bthomee
bthomee merged commit a896ed3 into XRPLF:develop Mar 10, 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. Trivial Simple change with minimal effect, or already tested. Only needs one approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants