Clear readability-identifier-length by renaming, not by configuring - #276
Merged
Conversation
The plan had been to widen `IgnoredParameterNames` with `m`, on the
understanding that it was the gtest matcher idiom. It is not: in
mbo/testing/matchers.h the `m` is a MAP - `AllKeys(const Map& m)`,
`IsKeyOf(const Map& m)` - and in matchers_test.cc `m` and `mm` are a map
and a multimap. Renaming them to `map` and `multi_map` is both clearer
and shorter than teaching the linter to ignore a letter repo-wide, so
.clang-tidy is untouched.
The rest, case by case:
* diff_benchmark.cc - `to` -> `to_pos`, `j` -> `pos`.
* hash_benchmark.cc - `d` -> `dist_idx`, `b` -> `point`. Not `dist`:
that name is already taken in the same loop by
`const LatencyDist& dist`, and the obvious rename would have
produced `dist = kLatencyDists[dist]`.
* ini_file.{h,cc} - `_` -> `unused` for the ignored half of a
structured binding.
* diff_myers.cc - waived for the file. `n`/`m` are the sequence
lengths, `d` the edit cost, `k` the diagonal, `x`/`y` the grid
coordinates, `kf`/`kr` the forward and reverse diagonals, `lo`/`hi`
the window bounds. That is the notation of Myers' paper, and
expanding it would break the correspondence that makes the code
checkable.
Verified the waiver is narrow: 20 findings from other checks still fire
in diff_myers.cc. The check reports zero across all affected files, and
bazel test --config=clang //... passes 109/109.
Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
helly25
enabled auto-merge (squash)
August 8, 2026 21:21
Fab-Cat
approved these changes
Aug 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sixth clang-tidy triage PR. Clears all 39
readability-identifier-lengthfindings..clang-tidyis untouched.The plan changed once I looked at the code
We had agreed to widen
IgnoredParameterNameswithm, on the understanding it was the gtest matcher idiom. It is not. Inmbo/testing/matchers.hthemis a map:and in
matchers_test.cc,mandmmare a map and a multimap. Renaming them tomapandmulti_mapis clearer and shorter than teaching the linter to ignore a letter across the whole repository — so no config change is needed, and the check keeps working everywhere else.The rest, case by case
diff_benchmark.ccto→to_pos,j→poshash_benchmark.ccd→dist_idx,b→pointini_file.{h,cc}_→unused(the ignored half of a structured binding)diff_myers.ccThe
hash_benchmark.ccrename is worth a note: the obvious choice,d→dist, collides withconst LatencyDist& distin the same loop and would have silently produceddist = kLatencyDists[dist]. Hencedist_idx.diff_myers.cckeeps its names because they are the notation of Myers' paper:n/mthe sequence lengths,dthe edit cost,kthe diagonal,x/ythe grid coordinates,kf/krthe forward and reverse diagonals,lo/hithe window bounds. Expanding those to three characters would break the correspondence to the paper that makes the algorithm checkable. The waiver is a single file-scoped region with that rationale, rather than 13 individual comments.Test
readability-identifier-lengthreports zero across every affected file.diff_myers.cc.bazel test --config=clang //...— 109/109 pass.pre-commit run -agreen.