Add clang-format/clang-tidy tooling, lint Stop hook, and http_server_example#2
Open
stigsb wants to merge 4 commits into
Open
Add clang-format/clang-tidy tooling, lint Stop hook, and http_server_example#2stigsb wants to merge 4 commits into
stigsb wants to merge 4 commits into
Conversation
Move the repo guidance into AGENTS.md (read by agent tooling generally) and point CLAUDE.md at it via symlink so both resolve to the same content.
- .clang-format: style matched to the codebase (clang-format 22). - .clang-tidy: broad bugprone/performance/modernize/readability/portability/ clang-analyzer families, with the checks the existing code does not yet satisfy disabled so the tree is green today; WarningsAsErrors keeps new violations from sneaking in. Design-driven disables (#pragma once, terse hot-path names, label macros) are grouped separately from the candidates to fix-and-re-enable later. - .pre-commit-config.yaml: clang-format via the pinned mirror; clang-tidy via scripts/run-clang-tidy-precommit.sh, which lints only translation units the compile DB knows about and skips gracefully when no build dir exists. - .claude/hooks/lint-check.sh + settings.json: a Stop hook that blocks turn completion until files changed vs HEAD are clang-format clean and clang-tidy clean. Both wrappers add the macOS SDK isysroot so clang-tidy can read an AppleClang compile database.
Mechanical reformat to the new .clang-format. No behavioural changes. label_def.hpp gains clang-format on/off guards around the preprocessor metaprogramming, whose hand-alignment clang-format would otherwise mangle.
examples/http_server_example.cpp exposes a Prometheus /metrics endpoint over cpp-httplib (closes the remaining example item in #1). Building it surfaced a pre-existing bug: detail/cache_line.hpp used std::hardware_destructive_interference_size without including <new>, which broke every example build on AppleClang; add the include.
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
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.
Summary
Adds the C++ lint toolchain and the remaining example from #1, plus a one-line bug fix surfaced while building it.
Reviewing commit-by-commit is recommended — the bulk reformat is isolated in its own commit.
Commits
AGENTS.md;CLAUDE.mdsymlinks to it.<new>fix — the example (/metricsover cpp-httplib) and the bug that blocked all example builds on AppleClang.Lint tooling
.clang-formatmatched to the existing style (clang-format 22)..clang-tidyenables broad check families, with the checks the current code doesn't satisfy disabled so the tree is green today andWarningsAsErrorsblocks regressions. Disabled checks are split into "design-driven, keep off" vs "candidates to fix-and-re-enable"..pre-commit-config.yaml: clang-format via the pinned mirror; clang-tidy viascripts/run-clang-tidy-precommit.sh, which lints only TUs the compile DB knows and skips gracefully when unconfigured..claude/hooks/lint-check.sh(+.claude/settings.json): a Stop hook that blocks a turn from finishing until files changed vs HEAD are clang-format- and clang-tidy-clean. Both wrappers add the macOS SDK-isysrootso clang-tidy can read an AppleClang compile database.Verification
ctest: 122/122 pass./metricsexample links.Addresses the
examples/http_server_example.cpp,.clang-format, and.clang-tidyitems in #1.Notes for the reviewer
bench/*(Google Benchmark isn't in the default compile DB); clang-format still does.modernize-use-nodiscard,modernize-use-ranges,readability-redundant-*) are real modernizations you may want to apply to the code and re-enable, rather than keep off.