chore: Enable clang-tidy bugprone-suspicious-stringview-data-usage check - #6467
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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-usagein.clang-tidy. - Update overlay request target prefix check to use
std::string_viewdirectly. - 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.
High Level Overview of Change
This PR enables clang-tidy
bugprone-suspicious-stringview-data-usagecheck.Context of Change
Type of Change
.gitignore, formatting, dropping support for older tooling)API Impact
No impact.
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)