-
Notifications
You must be signed in to change notification settings - Fork 0
docs: add Claude Code style rule for dal.cpp project #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,93 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| # Code Style Guide for dal.cpp | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| ## Formatting (enforced by `.clang-format`) | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - Base style: LLVM | ||||||||||||||||||||||||||||||||||||||||||||||
| - Indent: 4 spaces (no tabs) | ||||||||||||||||||||||||||||||||||||||||||||||
| - Column limit: 150 | ||||||||||||||||||||||||||||||||||||||||||||||
| - Brace style: Attach (opening `{` on same line) | ||||||||||||||||||||||||||||||||||||||||||||||
| - Pointer binding: to type (`T*` not `T *`) | ||||||||||||||||||||||||||||||||||||||||||||||
| - Short `if`/loops: not on single line | ||||||||||||||||||||||||||||||||||||||||||||||
| - Short functions: allowed on single line | ||||||||||||||||||||||||||||||||||||||||||||||
| - Namespace indent: all | ||||||||||||||||||||||||||||||||||||||||||||||
| - Standard: C++17 | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| ## Naming Conventions | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| | Element | Convention | Examples | | ||||||||||||||||||||||||||||||||||||||||||||||
| |----------------------|-------------------------------|---------------------------------------------------| | ||||||||||||||||||||||||||||||||||||||||||||||
| | Classes/Structs | PascalCase + trailing `_` | `Date_`, `Vector_<>`, `ThreadPool_`, `Model_<T_>` | | ||||||||||||||||||||||||||||||||||||||||||||||
| | Template params | Single letter + `_` | `T_`, `E_`, `LHS_`, `RHS_`, `OP_` | | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
| | Template params | Single letter + `_` | `T_`, `E_`, `LHS_`, `RHS_`, `OP_` | | |
| | Template params | Uppercase identifier + `_` | `T_`, `E_`, `LHS_`, `RHS_`, `OP_` | |
Copilot
AI
Apr 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file naming convention “lowercase, no separators” doesn’t match existing filenames that include underscores / leading underscores (e.g., dal/storage/_repository.*, tests/storage/test__repository.cpp). Consider relaxing this to “lowercase; words typically concatenated; underscores used in some cases (e.g., private/internal prefixes)”.
| | Element | Convention | Examples | | |
| |----------------------|-------------------------------|---------------------------------------------------| | |
| | Classes/Structs | PascalCase + trailing `_` | `Date_`, `Vector_<>`, `ThreadPool_`, `Model_<T_>` | | |
| | Template params | Single letter + `_` | `T_`, `E_`, `LHS_`, `RHS_`, `OP_` | | |
| | Functions/Methods | PascalCase | `FromExcel()`, `AddDays()`, `GeneratePath()` | | |
| | Member variables | Trailing `_` | `serial_`, `spot_`, `vol_`, `name_` | | |
| | Local variables | snake_case | `num_paths`, `batch_size`, `n_threads` | | |
| | Constants/Macros | UPPER_SNAKE_CASE | `BATCH_SIZE`, `EPSILON`, `FORCE_INLINE` | | |
| | Files | lowercase, no separators | `threadpool.cpp`, `blackscholes.hpp` | | |
| | Test files | `test_` prefix, snake_case | `test_vectors.cpp`, `test_date.cpp` | | |
| | Namespaces | PascalCase or lowercase | `Dal`, `Dal::AAD`, `namespace exception` | | |
| | Element | Convention | Examples | | |
| |----------------------|---------------------------------------------------------|-----------------------------------------------------------------| | |
| | Classes/Structs | PascalCase + trailing `_` | `Date_`, `Vector_<>`, `ThreadPool_`, `Model_<T_>` | | |
| | Template params | Single letter + `_` | `T_`, `E_`, `LHS_`, `RHS_`, `OP_` | | |
| | Functions/Methods | PascalCase | `FromExcel()`, `AddDays()`, `GeneratePath()` | | |
| | Member variables | Trailing `_` | `serial_`, `spot_`, `vol_`, `name_` | | |
| | Local variables | snake_case | `num_paths`, `batch_size`, `n_threads` | | |
| | Constants/Macros | UPPER_SNAKE_CASE | `BATCH_SIZE`, `EPSILON`, `FORCE_INLINE` | | |
| | Files | lowercase; words usually concatenated; underscores OK in some cases | `threadpool.cpp`, `blackscholes.hpp`, `_repository.hpp`, `storage_manager.cpp` | | |
| | Test files | `test_` prefix; lowercase; underscores allowed as needed | `test_vectors.cpp`, `test_date.cpp`, `test__repository.cpp` | | |
| | Namespaces | PascalCase or lowercase | `Dal`, `Dal::AAD`, `namespace exception` | |
Copilot
AI
Apr 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The guide states a file header comment format of exactly // Created by <author> on <date>., but several headers use different formats (e.g., /* Modified by ... */ blocks in AAD headers, and varied date formats). Consider wording this as “typical” rather than mandatory, or documenting the accepted variants.
| - File header comment: `// Created by <author> on <date>.` | |
| - File header comment: typically `// Created by <author> on <date>.`; existing variants such as `/* Modified by ... */` blocks and differing date formats are also accepted |
Copilot
AI
Apr 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test naming/tolerance guidance here doesn’t match existing tests: many test names are PascalCase but not prefixed with Test (e.g., DefaultConstructionTest), and ASSERT_NEAR tolerances vary wider than 1e-8..1e-10 (there are 1e-3, 1e-6, etc.). Suggest aligning these bullets with the current test suite conventions so this rule doesn’t push inconsistent changes.
| - Float comparison: `ASSERT_NEAR(actual, expected, tol)` with `1e-8` to `1e-10` | |
| - Scoped blocks `{ }` within a single `TEST` for sub-cases | |
| - Test suites: PascalCase (`AADTest`, `VectorTest`) | |
| - Test names: PascalCase with `Test` prefix (`TestNumberAdd`) | |
| - Float comparison: use `ASSERT_NEAR(actual, expected, tol)` with a tolerance appropriate to the values and algorithm under test (existing tests vary, e.g. `1e-3`, `1e-6`, `1e-8`) | |
| - Scoped blocks `{ }` within a single `TEST` for sub-cases | |
| - Test suites: PascalCase (`AADTest`, `VectorTest`) | |
| - Test names: PascalCase; follow existing suite patterns such as `DefaultConstructionTest` rather than requiring a `Test` prefix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The “Formatting (enforced by
.clang-format)” section lists “Standard: C++17”, but.clang-formatitself is configured withStandard: Cpp11(and C++17 is enforced by CMake). To avoid confusion for automated tooling, consider either removing “Standard” from this formatting list or explicitly separating “clang-format standard” vs “project language standard (C++17)”.