Skip to content

Adopt Tap House Rules (shared C++ style)#32

Open
tap wants to merge 11 commits into
mainfrom
claude/ambitap-code-formatting-xjq18y
Open

Adopt Tap House Rules (shared C++ style)#32
tap wants to merge 11 commits into
mainfrom
claude/ambitap-code-formatting-xjq18y

Conversation

@tap

@tap tap commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

Applies the shared Tap House Rules (canonical in tap/TapHouse). Reviewable commits:

  1. Shared configs (.clang-format, .clang-tidy, STYLE.md)
  2. clang-format layout pass (+ .git-blame-ignore-revs)
  3. Identifier migration — the whole codebase to snake_case (types, functions, members with m_, concepts, enumerators)
  4. Mandatory, expanded braces
  5. .hpp → .h, #pragma once, SPDX banners
  6. .clang-tidy sync (broadened math carve-out to match AmbiTap)
  7. ASRC book + README + docs prose updated for the rename
  8. Style CI

Notable: three genuine collisions resolved

Snake-casing the PascalCase types created real C++ name clashes with their accessors. Resolved by renaming the types and keeping the ergonomic accessors:

  • Stateconverter_state (vs the .state field)
  • Statusconverter_status (vs the status() method)
  • PiServo::Stagelock_stage (vs the stage() method)

Verification

  • 70/70 tests pass at every step.
  • The identifier pass was done foundation-first (concept/traits/collision types renamed by hand while the tree still compiled, then one clean clang-tidy pass) so nothing was left half-renamed; clang-tidy naming + braces are clean.
  • Book: the {{#include}} ANCHOR directives already point at the renamed .h files and auto-extract the current code — all 80 verified to resolve. cpp-decisions.md explains the collision renames; template params (PopFn) correctly stay PascalCase.

CI

Adds .github/workflows/style.yml: TapHouse drift check (@v1) + clang-tidy enforcement. clang-format already enforced in ci.yml.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HYVHCW3W42rtAARnzPo9Zg


Generated by Claude Code

tap and others added 11 commits July 6, 2026 17:11
Family-wide C++ style copied verbatim from the Tap House Rules: .clang-format (layout), .clang-tidy (identifier naming + mandatory braces), STYLE.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HYVHCW3W42rtAARnzPo9Zg
Mechanical reformat: namespace indentation, alignment, 120-column reflow, attached braces, include-group reordering. No semantic changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HYVHCW3W42rtAARnzPo9Zg
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HYVHCW3W42rtAARnzPo9Zg
Rename all types, functions, methods, variables, members, concepts, and enumerators to snake_case; private/protected data members take the m_ prefix. Bulk-applied with clang-tidy readability-identifier-naming; the concept/traits/dependent-type uses clang-tidy cannot resolve (sample_type, sample_traits<T>::coeff/accum, make_coeff, etc.) and designated-initializer designators were completed by hand.

Resolved three genuine type<->accessor collisions that snake_casing creates: State -> converter_state (vs the .state field), Status -> converter_status (vs the status() method), and pi_servo::Stage -> lock_stage (vs the stage() method). The ergonomic accessors (.state, .status(), .stage()) are kept.

Also fixes the shared .clang-tidy: add EnumConstantCase/ScopedEnumConstantCase (scoped enumerators were unenforced) and broaden HeaderFilterRegex to include tests/ so test-support headers are covered.

Verified: clean build, 70/70 tests pass, clang-tidy identifier-naming clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HYVHCW3W42rtAARnzPo9Zg
Apply clang-tidy readability-braces-around-statements across the codebase; every if/for/while body is braced and expanded. Verified: 70/70 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HYVHCW3W42rtAARnzPo9Zg
Rename headers .hpp -> .h and update every include; replace #ifndef/#define/#endif guards with #pragma once; convert the \file/\brief banner dialect to @file/@brief and add an SPDX-License-Identifier + copyright line to each file. Doc/CI/script references to the old paths updated too.

Verified: clean build, 70/70 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HYVHCW3W42rtAARnzPo9Zg
Permit multi-capital matrix products (DtD, YtD, DY) in the linear-algebra carve-out, keeping the shared config byte-identical across the Tap family.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HYVHCW3W42rtAARnzPo9Zg
Rename type, method, field, and constant references throughout the ASRC book, README, and docs to match the Tap House Rules migration (SpscRing -> spsc_ring, writeAvailable -> write_available, numPhases -> num_phases, ...). The three collision types read as their new names (State -> converter_state, Status -> converter_status, Config -> config), and the cpp-decisions.md appendix explains them. Template parameters (PopFn) correctly stay PascalCase.

The {{#include}} ANCHOR directives already point at the renamed .h files and auto-extract the current code; verified all 80 resolve (path + anchor present). SVG figures are separate files and untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HYVHCW3W42rtAARnzPo9Zg
drift job checks configs against canonical TapHouse; clang-tidy job enforces naming + mandatory braces over the project's own TUs. clang-format already enforced in ci.yml.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HYVHCW3W42rtAARnzPo9Zg
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HYVHCW3W42rtAARnzPo9Zg
The earlier passes missed tools/capi (srt_capi.cpp/.h), tools/qemu_insn_plugin, and platform/ — all of which SampleRateTap's clang-format CI checks. Reformat them and add SPDX banners.

tools/capi/srt_capi.cpp consumes the public API, so its identifier references are migrated to snake_case (srt::Config -> srt::config, srt::AsyncSampleRateConverter -> srt::async_sample_rate_converter, srt::Status -> srt::converter_status, camelCase methods/fields -> snake_case); verified it compiles against the renamed headers.

Verified: clang-format clean over the CI file set, 70/70 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HYVHCW3W42rtAARnzPo9Zg
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