Sponsored Content
Skip to content

chore: Enable clang-tidy bugprone-suspicious-stringview-data-usage check - #6467

Merged
bthomee merged 7 commits into
XRPLF:developfrom
godexsoft:chore/clang-tidy-checks-suspicious-stringview-data-usage
Mar 10, 2026
Merged

chore: Enable clang-tidy bugprone-suspicious-stringview-data-usage check#6467
bthomee merged 7 commits into
XRPLF:developfrom
godexsoft:chore/clang-tidy-checks-suspicious-stringview-data-usage

Conversation

@godexsoft

Copy link
Copy Markdown
Contributor

High Level Overview of Change

This PR enables clang-tidy bugprone-suspicious-stringview-data-usage 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 marked this pull request as ready for review March 4, 2026 13:48
@codecov

codecov Bot commented Mar 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.8%. Comparing base (45b8c4d) to head (36c1d05).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
src/xrpld/overlay/detail/OverlayImpl.cpp 0.0% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #6467   +/-   ##
=======================================
  Coverage     79.8%   79.8%           
=======================================
  Files          862     862           
  Lines        67875   67875           
  Branches      7551    7547    -4     
=======================================
+ Hits         54194   54198    +4     
+ Misses       13681   13677    -4     
Files with missing lines Coverage Δ
src/libxrpl/beast/core/CurrentThreadName.cpp 75.0% <ø> (ø)
src/xrpld/overlay/detail/OverlayImpl.cpp 32.8% <0.0%> (ø)

... and 2 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-suspicious-stringview-data-usage check and updates a few call sites to avoid potentially unsafe string_view::data() usage when APIs expect null-terminated strings.

Changes:

  • Enable bugprone-suspicious-stringview-data-usage in .clang-tidy.
  • Update overlay request target prefix check to use std::string_view directly.
  • Adjust tests and thread-naming code to address (or suppress) new clang-tidy findings.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/xrpld/overlay/detail/OverlayImpl.cpp Uses starts_with(std::string_view) instead of starts_with(prefix.data()).
src/test/rpc/AccountInfo_test.cpp Replaces isMember(fName.data()) with a std::string key (but still has a remaining unsafe .data() use).
src/test/core/Config_test.cpp Replaces .data() uses with std::string conversions when passing to APIs expecting std::string.
src/libxrpl/beast/core/CurrentThreadName.cpp Adds NOLINT suppressions for .data() passed to pthread APIs / snprintf.
.clang-tidy Turns on bugprone-suspicious-stringview-data-usage.

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

Comment thread src/test/rpc/AccountInfo_test.cpp
Comment thread src/libxrpl/beast/core/CurrentThreadName.cpp
Comment thread src/libxrpl/beast/core/CurrentThreadName.cpp

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

LGTM

Comment thread src/libxrpl/beast/core/CurrentThreadName.cpp
@godexsoft
godexsoft requested a review from bthomee March 9, 2026 17:37
@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 enabled auto-merge (squash) March 10, 2026 07:56
@bthomee
bthomee merged commit 320a65f into XRPLF:develop Mar 10, 2026
2 of 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