Skip to content

chore: enable readability-identifier-naming check and fix violations - #764

Merged
egolearner merged 15 commits into
alibaba:mainfrom
egolearner:feat/clang-tidy-naming-check
Sep 18, 2026
Merged

egolearner merged 15 commits into
alibaba:mainfrom
egolearner:feat/clang-tidy-naming-check

Conversation

@egolearner

Copy link
Copy Markdown
Collaborator

Summary

  • Enable clang-tidy readability-identifier-naming (Google-style base with project tweaks) across sources, tests, and tools — including headers.
  • Fix all existing naming violations via a bundled clang-tidy auto-fix sweep plus manual disambiguation of rename collisions.
  • Exempt generated code (fts_column/gen, sqlengine/antlr/gen) via local .clang-tidy overrides.

Rules

  • Functions/methods: snake_case.
  • Static/global functions: snake_case OR UpperCamelCase.
  • Struct/class member variables: snake_case (trailing _ not required).
  • Local variables and parameters: snake_case.
  • Constants: left loose.

Notes

  • Manual fixes resolved cross-TU rename collisions (method vs local/param, template primary vs specialization, out-of-line def vs header decl) by renaming the colliding local/param to a distinct snake_case name or qualifying member calls with this->.
  • Verified with a full local build (lib + tools + all 208 test binaries compile & link clean) and a full readability-identifier-naming re-scan reporting 0 violations. Unit tests were not run.

Test plan

  • CI build passes
  • CI clang-tidy / lint passes

Add a Google-style-based readability-identifier-naming configuration to
.clang-tidy with project-specific tweaks:
- member functions use snake_case; static/global functions may use
  snake_case or upper-camel CamelCase
- struct/class data members use snake_case, trailing underscore optional
- local variables and parameters use snake_case; constants stay loose
- fix the broken HeaderFilterRegex so headers are covered

Auto-fix all existing naming violations across src/tests/tools and insert
missing override specifiers. Generated ANTLR/FTS code and vendored third-party
files are exempted via per-directory configs and NOLINT ranges.
…g-check

# Conflicts:
#	src/core/utility/buffer_storage.cc
#	src/core/utility/visit_filter.h
#	tests/ailego/buffer/vector_page_table_test.cc
egolearner and others added 8 commits September 17, 2026 16:34
The naming sweep ran only against TUs compiled on macOS arm64
(RABITQ_SUPPORTED=false, DISKANN_SUPPORTED=true), so it missed:
- ivf_rabitq_index.cc train() calling GenerateHolder() in the
  RABITQ_SUPPORTED branch (fails on Linux x86_64).
- diskann_index.cc !DISKANN_SUPPORTED fallback still defining
  CreateAndInitStreamer()/GenerateHolder() (fails on Intel macOS).

Align both to the snake_case declarations in index.h.
The rename and merge-resolution edits left continuation-line alignment
and wrapping that violated clang-format, failing the lint CI. Reformat
the affected sources, headers, tools, and tests to satisfy the
repository's clang-format 18.1.8 style.
The readability-identifier-naming sweep ran on macOS arm64, so Linux- and
RABITQ-guarded paths were inactive and kept stale CamelCase references to
renamed symbols, breaking Linux/x86 compilation:

- src/db/common/cgroup_util: rename Linux-only methods read_proc_stat,
  read_memory_usage_cgroup, read_memory_usage_proc, calculate_linux_cpu_usage
  and update extract_memory_value call sites in the PLATFORM_LINUX block.
- src/core/algorithm/hnsw_rabitq: update stg->is_huge_page() call sites in
  hnsw_rabitq_chunk.cc and hnsw_rabitq_streamer_entity.cc (RABITQ_SUPPORTED=1).
x86/Linux/RABITQ-only paths were not compiled during the arm64 sweep, so
clang-tidy on Linux x86 flagged legitimate names the sweep never saw:

- matrix_utility.i: exempt x86 SIMD helpers (Operation_TYPE_WIDTH convention).
- libaio_def.h / iouring_def.h: exempt structs/enums copied verbatim from the
  Linux kernel ABI, which must keep their upstream names.
- inverted_search_result.h (AND/OR) and segment.h (Delete): move the NOLINT
  onto NOLINTNEXTLINE above each declaration so it lands on the flagged line;
  these keep upper-case names because and/or/delete are C++ keywords.
- hnsw_rabitq_chunk.h: NOLINT the on-disk CHUNK_TYPE enum tag.
…pt generated files in clang-tidy CI

Fix modernize-use-equals-delete/default, use-override, and bugprone-sizeof
violations in RaBitQ, libaio, and SIMD headers exposed by the broadened
HeaderFilterRegex. Rename local index_meta_ptr_ to satisfy identifier-naming.

Skip auto-generated files (antlr/gen, fts_column/gen) in the compile_commands
filter step so generated code is never analyzed, without editing those files.
@egolearner
egolearner requested a review from Cuiyus as a code owner September 17, 2026 12:22
…tics

Rename PascalCase fixture helpers in collection_test.cc to snake_case and
fix undeclared-identifier errors in write_recovery_test.cc (both from merged
main). Drop generated-header diagnostics that leak into clang-tidy via #include
from non-generated main files, since those headers are exempt and uneditable.
Avoid shadowing matrix dimensions with the transpose loop index and update Windows cleanup calls to the renamed helper. Surface Arrow sub-build errors in CI logs.
@egolearner
egolearner merged commit d2f1891 into alibaba:main Sep 18, 2026
19 checks passed
@egolearner
egolearner deleted the feat/clang-tidy-naming-check branch September 18, 2026 02:07
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.

2 participants