feat: add C++ language support and hook tests (#539)

- agents: cpp-build-resolver, cpp-reviewer
- commands: cpp-build, cpp-review, cpp-test
- rules: cpp/ (coding-style, hooks, patterns, security, testing)
- tests: 9 new hook test files with comprehensive coverage

Cherry-picked from PR #436.
This commit is contained in:
Affaan Mustafa
2026-03-16 14:31:49 -07:00
committed by GitHub
parent f12bb90924
commit b6595974c2
19 changed files with 2471 additions and 0 deletions

44
rules/cpp/coding-style.md Normal file
View File

@@ -0,0 +1,44 @@
---
paths:
- "**/*.cpp"
- "**/*.hpp"
- "**/*.cc"
- "**/*.hh"
- "**/*.cxx"
- "**/*.h"
- "**/CMakeLists.txt"
---
# C++ Coding Style
> This file extends [common/coding-style.md](../common/coding-style.md) with C++ specific content.
## Modern C++ (C++17/20/23)
- Prefer **modern C++ features** over C-style constructs
- Use `auto` when the type is obvious from context
- Use `constexpr` for compile-time constants
- Use structured bindings: `auto [key, value] = map_entry;`
## Resource Management
- **RAII everywhere** — no manual `new`/`delete`
- Use `std::unique_ptr` for exclusive ownership
- Use `std::shared_ptr` only when shared ownership is truly needed
- Use `std::make_unique` / `std::make_shared` over raw `new`
## Naming Conventions
- Types/Classes: `PascalCase`
- Functions/Methods: `snake_case` or `camelCase` (follow project convention)
- Constants: `kPascalCase` or `UPPER_SNAKE_CASE`
- Namespaces: `lowercase`
- Member variables: `snake_case_` (trailing underscore) or `m_` prefix
## Formatting
- Use **clang-format** — no style debates
- Run `clang-format -i <file>` before committing
## Reference
See skill: `cpp-coding-standards` for comprehensive C++ coding standards and guidelines.