Repository navigation
lint: fix clang-tidy errors exposed by WarningsAsErrors '*' - #7707
Conversation
clang-tidy's performance-inefficient-vector-operation check flags these four loops. They became hard errors when dashpay#7693 backported bitcoin#26905, which replaced the explicit WarningsAsErrors allowlist in src/.clang-tidy with '*'. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
readability-const-return-type: a const-qualified by-value return adds nothing here, and is now a hard error under WarningsAsErrors '*'. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. WalkthroughThe change pre-reserves vector capacity in quorum proof construction and RPC handlers before appending hashes, commitment leaves, or public keys. It also removes a top-level Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
thepastaclaw
left a comment
There was a problem hiding this comment.
⚠️ DEGRADED — Final validation — Phase 1 + Phase 2
⚠️ DEGRADED review. The primary review models were unavailable (gpt-6-astraunavailable: All credentials for model gpt-6-astra are cooling down (last error: usage_limit_reached: The usage limit has been reache), so this review ran on stand-in models:gpt-5.6-luna→muse-spark-1.3-contributor,gpt-5.6-sol→muse-spark-1.3-contributor,gpt-5.6-terra→muse-spark-1.3-contributor,gpt-6-astra→muse-spark-1.3-contributor. Both review phases and the independent verifiers still ran, but on weaker models, with Phase 1 capped athigheffort. Treat the verdict as provisional; a full-strength re-review will run on the next push once the primary models are back.
Lint-only fix verified against the diff: four reserve() calls use exact up-front sizes with one push per slot, and dropping top-level const from the by-value optional return is a behavior-preserving no-op. No behavior change, no correctness risk.
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: dash-core-commit-history); reviewer 3: muse-spark-1.3-contributor (standing in for gpt-6-astra) (agent: phase2-reviewer, role: general); reviewer 4: muse-spark-1.3-contributor (standing in for gpt-6-astra) (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: muse-spark-1.3-contributor (standing in for gpt-6-astra) (agent: astra-verifier, role: final-verifier)
- Degraded mode:
gpt-6-astraunavailable: All credentials for model gpt-6-astra are cooling down (last error: usage_limit_reached: The usage limit has been reache (detected by probe, since 2026-09-20T20:45:34Z); stand-insgpt-5.6-luna→muse-spark-1.3-contributor,gpt-5.6-sol→muse-spark-1.3-contributor,gpt-5.6-terra→muse-spark-1.3-contributor,gpt-6-astra→muse-spark-1.3-contributor; Phase 1 effort capped athigh - Triage:
lowbymuse-spark-1.3-contributor(standing in forgpt-6-astra) (effort low) — Adds vector reserve() calls and removes top-level const on a by-value return across 4 files with no behavior change, small and easy to verify. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort high); agentphase1-reviewer,muse-spark-1.3-contributor— dash-core-commit-history (completed, effort high); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(lane failed),glm-5.3-flash(zai below 15% reserve: 5h 100% left, weekly 13% left) - Fresh verifier:
muse-spark-1.3-contributor(standing in forgpt-6-astra) — final-verifier; agentastra-verifier - Phase 2 reviewers:
muse-spark-1.3-contributor(standing in forgpt-6-astra) — general (completed, effort medium); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6-astra) — dash-core-commit-history (completed, effort medium); agentphase2-reviewer
Since #7707 set WarningsAsErrors: '*' in .clang-tidy, the ten clang-tidy findings in the shared masternode Qt tests merged with #7701 fail the linux64_multiprocess-build lint step. Match the argument comments to CBLSLazyWrapper::Set's specificLegacyScheme parameter, bind const references instead of copying from accessors and optionals that outlive the use, drop const from a returned shared_ptr so it can be moved, and reserve before a push_back loop. Test-only change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tests 2543d64 fix(qt): resolve clang-tidy errors in shared masternode tests (pasta) Pull request description: ## Issue being fixed or feature implemented Since #7707, `.clang-tidy` has `WarningsAsErrors: '*'`, so every clang-tidy finding fails the lint step. #7701 (shared masternode Qt GUI) then merged Qt tests that trigger ten clang-tidy checks. As a result, develop's `linux64_multiprocess-build` job has failed in its "Run linters" step since e5de15a (e.g. https://github.com/dashpay/dash/actions/runs/35780433329/job/106931610784). ## What was done? This change only touches tests (`src/qt/test/`). It makes mechanical fixes for exactly the ten errors in the failing job log (deduplicated): - `masternodetestutil.cpp:114` `performance-no-automatic-move`: dropped `const` from the local `shared_ptr<CWallet>` so the return can move it. - `masternodetestutil.cpp:211`, `masternodemaintenancetests.cpp:613` `bugprone-argument-comment`: changed `/*bls_legacy_scheme=*/` to `/*specificLegacyScheme=*/` to match the parameter name of `CBLSLazyWrapper::Set`. The callee is unchanged. - `masternodewidgettests.cpp:212` `performance-inefficient-vector-operation`: added `ret.reserve(m_shares.size())` before the `push_back` loop. - `mnsharesessiontests.cpp:695,698,725` `performance-unnecessary-copy-initialization`: `alice`, `bob` and `conflicting` are now `const MnShareSession&` bound to the function-local `std::optional`s they were copied from. Each optional outlives its reference, and `mergeEnvelope` takes `const MnShareSession&`. - `masternodemaintenancetests.cpp:683,685,925` `performance-unnecessary-copy-initialization`: `shares` and `voting` are now `const&` to `MasternodeEntry::shares()` / `votingAddress()`. The `entry` they reference is a function-local that is only passed on by const reference (`UpdateShareDialog` / `DissolveDialog` constructors), so the references stay valid. ## How Has This Been Tested? On macOS arm64, with depends and `--enable-debug`: - `make -C src qt/test/test_dash-qt` builds cleanly. - `QT_QPA_PLATFORM=minimal src/qt/test/test_dash-qt`: every suite passes, including MasternodeWidgetTests, MnShareSessionTests, MasternodeMaintenanceTests, SharedMnWidgetTests, SharedMnWizardTests and SharedMnWalkthroughTests. The only skip is the existing `OptionTests::updateFontsWithPixelSizedWidget`, which cannot run under the minimal platform plugin. - I ran clang-tidy (Homebrew LLVM 22.1.8; CI uses llvm-19) with the repo `.clang-tidy` on the four files, using a compile database built from the real compile commands. On the base commit it reproduces all ten errors from the CI log. With this change it reports zero diagnostics. - `contrib/devtools/clang-format-diff.py` reports nothing for the diff. ## Breaking Changes None. Test-only change. ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Top commit has no ACKs. Tree-SHA512: d20b1a7a5ccf7da96c29b666834581a6bd4b9d60f71b9a23f921daf6fde62c52cb6fe11e25f26b2f2f74443f2b03b8f5fcc71c607a8f1a185bd37d241654baa2
Issue being fixed or feature implemented
developcurrently fails thelinux64_multiprocess-build / Build source→ "Run linters" step (ci/dash/lint-tidy.sh).#7693 backported bitcoin#26905, which replaced the explicit
WarningsAsErrorsallowlist insrc/.clang-tidywithWarningsAsErrors: '*'(and added a matching-warnings-as-errors=-clang-diagnostic-old-style-cast,-google-readability-castingtoci/dash/lint-tidy.shso the C-style-cast checks stay advisory). Every other enabled check is now a hard error, which promoted five pre-existing diagnostics from warnings to build failures:The three quorum-proof sites came in with #7107; the two
rpc/sites are older code that was only ever a warning before.The failure is not visible on PRs branched before #7693 merged, because CI checks out the PR head and therefore uses that branch's
.clang-tidy. It shows up on any PR whose merge base is at or after #7693 — e.g. https://github.com/dashpay/dash/actions/runs/35530545254/job/106137443857.What was done?
hashes.reserve(...)/leaves.reserve(...)/pubkeys.reserve(...)ahead of the four flagged loops. The sizes are known up front in every case, so this is also a small genuine improvement.constfromExpectedType's by-value return type insrc/rpc/util.cpp. It never conferred anything.No behavior changes.
How Has This Been Tested?
Reproduced the failure and verified the fix locally with clang-tidy 19 (same major version as CI's
LLVM_VERSION), running the repo'ssrc/.clang-tidyconfig against a compilation database for the four affected translation units:llmq/quorumproofs.cpperrors reproduce verbatim, including the[performance-inefficient-vector-operation,-warnings-as-errors]tag from CI.performance-inefficient-vector-operationand zeroreadability-const-return-typediagnostics across all four files.All four translation units compile clean (
rpc/util.cpp,rpc/output_script.cpp,rpc/quorums.cpp,llmq/quorumproofs.cpp) on anaarch64-apple-darwindepends build. Full CI will cover the rest.Breaking Changes
None.
Checklist:
🤖 Generated with Claude Code