Sponsored Content
Skip to content

chore: Enable clang-tidy bugprone-inc-dec-in-conditions check - #6455

Merged
bthomee merged 10 commits into
XRPLF:developfrom
godexsoft:chore/clang-tidy-checks-inc-dec-conditions
Mar 10, 2026
Merged

chore: Enable clang-tidy bugprone-inc-dec-in-conditions check#6455
bthomee merged 10 commits into
XRPLF:developfrom
godexsoft:chore/clang-tidy-checks-inc-dec-conditions

Conversation

@godexsoft

@godexsoft godexsoft commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

High Level Overview of Change

This PR enables the bugprone-inc-dec-in-conditions 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

  • 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 the DraftRunCI Normally CI does not run on draft PRs. This opts in. label Mar 3, 2026
@godexsoft godexsoft changed the title Enable new check chore: Enable clang-tidy bugprone-inc-dec-in-conditions check Mar 3, 2026
@codecov

codecov Bot commented Mar 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@8345cd7). Learn more about missing BASE report.
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
src/libxrpl/json/json_reader.cpp 0.0% 6 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##             develop   #6455   +/-   ##
=========================================
  Coverage           ?   79.8%           
=========================================
  Files              ?     862           
  Lines              ?   67881           
  Branches           ?    7570           
=========================================
  Hits               ?   54175           
  Misses             ?   13706           
  Partials           ?       0           
Files with missing lines Coverage Δ
src/libxrpl/basics/base64.cpp 100.0% <100.0%> (ø)
src/libxrpl/json/json_writer.cpp 93.9% <100.0%> (ø)
src/libxrpl/ledger/BookDirs.cpp 86.7% <100.0%> (ø)
src/libxrpl/json/json_reader.cpp 67.8% <0.0%> (ø)

Impacted file tree graph

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

@godexsoft godexsoft removed the DraftRunCI Normally CI does not run on draft PRs. This opts in. label Mar 3, 2026
@godexsoft
godexsoft marked this pull request as ready for review March 3, 2026 14:29
Copilot AI review requested due to automatic review settings March 3, 2026 14:29

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

This PR enables the bugprone-inc-dec-in-conditions clang-tidy check and refactors a couple of existing call sites to avoid increment/decrement side effects inside conditional expressions.

Changes:

  • Enable bugprone-inc-dec-in-conditions in .clang-tidy.
  • Refactor BookDirs::const_iterator::operator++() to remove ++cur_key_ from a conditional expression.
  • Refactor JSON surrogate-pair parsing to avoid current++ inside a conditional expression.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
.clang-tidy Turns on the bugprone-inc-dec-in-conditions check and removes it from the “disabled due to issues” list.
src/libxrpl/ledger/BookDirs.cpp Reworks iterator advancement logic to avoid increment in the if condition.
src/libxrpl/json/json_reader.cpp Rewrites surrogate-pair detection to avoid pointer increments in the if condition and keep parsing behavior explicit.

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

Comment thread .clang-tidy
@godexsoft godexsoft changed the title chore: Enable clang-tidy bugprone-inc-dec-in-conditions check chore: Enable clang-tidy bugprone-inc-dec-in-conditions check Mar 3, 2026
…om:godexsoft/rippled into chore/clang-tidy-checks-inc-dec-conditions
Comment thread src/libxrpl/ledger/BookDirs.cpp Outdated
@godexsoft
godexsoft requested a review from bthomee March 9, 2026 13:47
@bthomee
bthomee requested a review from vvysokikh1 March 10, 2026 11:57
@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 10, 2026
@bthomee
bthomee enabled auto-merge (squash) March 10, 2026 19:51
@bthomee
bthomee merged commit f27d8f3 into XRPLF:develop Mar 10, 2026
1 check 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