Skip to content

fix(tidy): the 31 non-swappable #681 clang-tidy rows — 21 fixed byte-identical, 10 baselined - #734

Merged
joyful-ii-V-I merged 1 commit into
mainfrom
lane/tidy-681a
Nov 24, 2026
Merged

joyful-ii-V-I merged 1 commit into
mainfrom
lane/tidy-681a

Conversation

@joyful-ii-V-I

@joyful-ii-V-I joyful-ii-V-I commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

tidy: fix or baseline the 31 non-swappable clang-tidy rows of #681

Triage of the nightly advisory clang-tidy NEW rows in #681, except the 74 bugprone-easily-swappable-parameters rows (they belong to a separate quality-delta card). Every one of the 31 rows was still on main at 5a3df04. 21 are fixed and 10 are accepted into .clang-tidy-baseline.txt, each with a one-line reason in the commit message. Six baseline rows that the nightly reports as GONE, whose source text no longer exists, are deleted.

check rows fixed accepted note
performance-inefficient-vector-operation 5 5 0 reserve() before the push loops
bugprone-unchecked-optional-access 3 0 3 each is guarded: every caller checks head_; last is emplaced on round 0; capturedWhole checks the optional
performance-unnecessary-value-param 3 2 1 Script::visit takes reach by const& (each recursion copied it); dedupeLintFindings moves kept rows; groupRunTail keeps the house EscapeFn-by-value form (9 sibling rows are already baselined)
bugprone-incorrect-roundings 2 0 2 tangle T and S are never negative; half-up + 0.5 is the shared rounding
bugprone-narrowing-conversions 2 2 0 explicit char casts
clang-analyzer-deadcode.DeadStores 2 0 2 disposition is read by the DispositionTally RAII guard
bugprone-exception-escape 1 1 0 the noexcept AnswerFirstFallback::disclose called emitTo, whose std::print could throw bad_alloc; it now calls emitRaw with the same bytes
bugprone-implicit-widening-of-multiplication-result 1 1 0 kLargeBytes is computed in size_t
bugprone-inc-dec-in-conditions 1 1 0 the rc-file scan lambda is named before the condition
bugprone-signed-char-misuse 1 1 0 cmakeCallStart compares unsigned with unsigned. This was latent only: every command name is ASCII
bugprone-suspicious-missing-comma 1 0 1 a deliberate four-line string concatenation (its old-text row is deleted)
bugprone-suspicious-stringview-data-usage 1 1 0 memstats::mark now takes the const char* literal that notePhase keeps
bugprone-throwing-static-initialization 1 0 1 gLangMap can only throw bad_alloc while building four default suffixes, before main runs
clang-analyzer-optin.performance.Padding 1 1 0 MemberShape puts the widest members first
performance-for-range-copy 1 1 0 const std::string&
performance-move-const-arg 1 1 0 pushTypedBind takes const DeclType&, so the move was a copy
performance-no-automatic-move 1 1 0 the local is no longer const, so the return moves it
total 31 21 10

None of the fixes is an output bug. Every fix leaves the output byte-identical (evidence below).

Byte-identity evidence

  • --deps and map md5 on the large-repo corpus: on envoy, cockroach and vscode, --deps and the plain map give 6/6 identical stdout, stderr and rc. The base is the 0.7.0 binary built from e3d766cd6, whose src/ is identical to main 5a3df04. The lane is 510c82f. Both runs used --no-cache.
  • Touched-file gates: 18 gates, all rc=0. They are memstats, memceiling, cloneidiom, cloneoperand, defectshape, formanifest, exemplar, tangle, lint, lintdedup, foranswerfirst, forpages, usingdecl, attribmultidef, fieldnarrow, qschemetrip, cha and printffmtparity. printffmtparity printed "ALL PASS ... over 42 verbs".
  • fire321 was not run. These are refactors that should leave output byte-identical, and the md5 runs above cover the edge and answer paths.
  • quality-delta over origin/main..HEAD: gating=0. It reported one minor verbosity row (switchArmsOf 64→65, from the reserve() line).

No regression arms were added: none of the correctness-candidate rows turned out to be a live output bug.

Refs #681 (non-swappable rows)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Updated the accepted static-analysis findings baseline.
  • Refactor

    • Made small efficiency and consistency improvements across internal processing and reporting.
    • No user-facing behavior changes are indicated.

Fixed (output byte-identical):
- performance-inefficient-vector-operation x5: reserve() before the push loops
  (pyUnhandledOutcome, switchArmsOf, retargetCfgTouchLines, appendTangleRatchet, compilerOutputs).
- performance-unnecessary-value-param: Script::visit takes reach by const& (each recursion copied it);
  dedupeLintFindings moves the kept rows out of the moved-in `outs` instead of copying them.
- bugprone-narrowing-conversions x2: explicit char casts (defGroupsSilent, cppScopeNames |= bit).
- bugprone-exception-escape: AnswerFirstFallback::disclose is noexcept but emitTo's std::print could
  throw bad_alloc; the two constant messages now go through emitRaw (same bytes).
- bugprone-implicit-widening-of-multiplication-result: kLargeBytes multiplies in size_t.
- bugprone-inc-dec-in-conditions: the rc-file scan lambda is named before the condition, not
  invoked inside it (unreadRcFileSites).
- bugprone-signed-char-misuse: cmakeCallStart compares unsigned char to unsigned char (latent:
  every kCMakeCommands name is ASCII today).
- bugprone-suspicious-stringview-data-usage: memstats::mark takes the const char* literal that
  notePhase keeps, so the NUL-termination is in the type, not a comment.
- clang-analyzer-optin.performance.Padding: MemberShape widest members first, one-byte fields last.
- performance-for-range-copy: jsPatternNames loop binds const std::string&.
- performance-move-const-arg: pushTypedBind takes const DeclType&; the std::move was a copy.
- performance-no-automatic-move: unjudgedBase's byName is no longer const, so the return moves.

Accepted (baseline rows added):
- bugprone-unchecked-optional-access graph.h `*head_`: every caller of mayRunCandidate checks
  head_.has_value() first (runsOnlyStd short-circuits, declineList / pruneTier return early).
- bugprone-unchecked-optional-access shstatus.h `*last`: the round loop emplaces it on round 0.
- bugprone-unchecked-optional-access verbs_for.h `r.out->bytes`: capturedWhole(r.out) checks has_value.
- performance-unnecessary-value-param testmap.h groupRunTail: the house EscapeFn-by-value form
  (9 sibling rows already baselined).
- bugprone-incorrect-roundings model.h x2: tangle T / S are never negative; half-up `+ 0.5` is the
  documented rounding every surface shares.
- clang-analyzer-deadcode.DeadStores graph.h x2 (one more occurrence each): `disposition` is read by
  the DispositionTally RAII guard at each continue.
- bugprone-suspicious-missing-comma legenddict.h: the kCoreEntries first entry is one deliberately
  concatenated four-line literal (its old-text row is deleted).
- bugprone-throwing-static-initialization lsp.h gLangMap: only bad_alloc of the four default
  overrule suffixes, before main.

Deleted baseline rows the nightly no longer reports (source gone): defectshape faster-string-find,
ingest_valuerefs move-const-arg, legenddict old missing-comma text, testmap exception-escape
groupable, and one `{` branch-clone each in defectshape.h and lsp.h.

The 74 bugprone-easily-swappable-parameters rows are left for their own qd card.

Refs #681

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Walkthrough

The pull request updates analysis and utility code in several headers. It also changes the clang-tidy baseline count and finding records.

Changes: C++ and baseline updates

Layer / File(s) Summary
Analysis traversal and result handling
src/cloneidiom.h, src/defectshape.h, src/ingest_binds.h, src/ingest_jsimports.h, src/quality.h, src/resolve.h, src/verbs_lint.h
Analysis code changes traversal parameter passing, extracts an existing run-node search, reserves vector capacity, and moves retained values instead of copying them.
Conversions and utility updates
src/defattrib.h, src/foranswerfirst.h, src/formanifest.h, src/memceiling.h, src/memstats.h, src/receiverevidence.h, src/shstatus.h
The changes add explicit conversions, update command-name comparison for non-ASCII bytes, change memstats::mark to accept const char*, switch two fallback messages to rw::emitRaw, and reserve temporary-vector capacity.
Clang-tidy baseline records
.clang-tidy-baseline.txt
The reported finding count changes from 967 to 971. Finding rows are added and removed, and one anchor description is revised.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested reviewers: barefootski

Merge Risk: Minimal · up to 510c8

This change tidies analysis code and updates the clang-tidy baseline. It is intended to leave output unchanged, and the author reports identical results on three large projects. No actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the fix to 31 non-swappable clang-tidy rows from #681, with 21 fixed byte-identical and 10 baselined. The changeset matches this: source edits (reserve calls, references/moves, emitRaw…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the fix to 31 non-swappable clang-tidy rows from #681, with 21 fixed byte-identical and 10 baselined. The changeset matches this: source edits (reserve calls, references/moves, emitRaw in AnswerFirstFallback::disclose, the memstats signature change) and the .clang-tidy-baseline.txt update (967 to 971 findings, obsolete rows removed). The title is specific and states the main change, though it uses a dense format with an issue reference and a dash-separated count breakdown.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5a3df04 and 510c82f.

Files selected for processing: 15

  • .clang-tidy-baseline.txt
  • src/cloneidiom.h
  • src/defattrib.h
  • src/defectshape.h
  • src/foranswerfirst.h
  • src/formanifest.h
  • src/ingest_binds.h
  • src/ingest_jsimports.h
  • src/memceiling.h
  • src/memstats.h
  • src/quality.h
  • src/receiverevidence.h
  • src/resolve.h
  • src/shstatus.h
  • src/verbs_lint.h

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@joyful-ii-V-I
joyful-ii-V-I merged commit 15c67db into main Nov 24, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant