|
| 1 | +# Contributing to Container System |
| 2 | + |
| 3 | +Thank you for considering contributing to Container System\! This document provides guidelines and instructions for contributors. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +- [Getting Started](#getting-started) |
| 8 | +- [Development Workflow](#development-workflow) |
| 9 | +- [Code Standards](#code-standards) |
| 10 | +- [Testing](#testing) |
| 11 | +- [Pull Requests](#pull-requests) |
| 12 | + |
| 13 | +## Getting Started |
| 14 | + |
| 15 | +### Prerequisites |
| 16 | + |
| 17 | +- C++20 compatible compiler (GCC 13+, Clang 16+, MSVC 2022+) |
| 18 | +- CMake 3.20 or higher |
| 19 | +- Git |
| 20 | +- vcpkg (recommended) |
| 21 | + |
| 22 | +### Building from Source |
| 23 | + |
| 24 | +```bash |
| 25 | +git clone https://github.com/kcenon/container_system.git |
| 26 | +cd container_system |
| 27 | +cmake --preset default |
| 28 | +cmake --build build |
| 29 | +``` |
| 30 | + |
| 31 | +### Running Tests |
| 32 | + |
| 33 | +```bash |
| 34 | +cd build |
| 35 | +ctest --output-on-failure |
| 36 | +``` |
| 37 | + |
| 38 | +## Development Workflow |
| 39 | + |
| 40 | +1. Fork the repository |
| 41 | +2. Create a feature branch (`git checkout -b feature/your-feature`) |
| 42 | +3. Make your changes |
| 43 | +4. Run tests and ensure they pass |
| 44 | +5. Commit your changes (see commit message guidelines below) |
| 45 | +6. Push to your fork (`git push origin feature/your-feature`) |
| 46 | +7. Open a Pull Request |
| 47 | + |
| 48 | +### Commit Message Guidelines |
| 49 | + |
| 50 | +Follow the [Conventional Commits](https://www.conventionalcommits.org/) format: |
| 51 | + |
| 52 | +``` |
| 53 | +<type>(<scope>): <description> |
| 54 | +
|
| 55 | +[optional body] |
| 56 | +
|
| 57 | +[optional footer] |
| 58 | +``` |
| 59 | + |
| 60 | +**Types:** |
| 61 | +- `feat`: New feature |
| 62 | +- `fix`: Bug fix |
| 63 | +- `docs`: Documentation changes |
| 64 | +- `refactor`: Code refactoring |
| 65 | +- `test`: Adding or modifying tests |
| 66 | +- `perf`: Performance improvement |
| 67 | +- `chore`: Maintenance tasks |
| 68 | + |
| 69 | +## Code Standards |
| 70 | + |
| 71 | +### C++ Style |
| 72 | + |
| 73 | +- Use C++20 features when beneficial |
| 74 | +- Follow existing code style (clang-format configuration provided) |
| 75 | +- Prefer RAII for resource management |
| 76 | +- Use `auto` for obvious types |
| 77 | +- Avoid raw pointers; use smart pointers |
| 78 | +- Prefer standard library over custom implementations |
| 79 | + |
| 80 | +### Naming Conventions |
| 81 | + |
| 82 | +- **Classes/Structs**: `snake_case` |
| 83 | +- **Functions/Methods**: `snake_case` |
| 84 | +- **Variables**: `snake_case` |
| 85 | +- **Constants**: `UPPER_SNAKE_CASE` |
| 86 | +- **Template Parameters**: `PascalCase` |
| 87 | +- **Namespaces**: `kcenon::container` |
| 88 | + |
| 89 | +### Documentation |
| 90 | + |
| 91 | +Use Doxygen-style comments: |
| 92 | + |
| 93 | +```cpp |
| 94 | +/** |
| 95 | + * @brief Brief description |
| 96 | + * @param param Parameter description |
| 97 | + * @return Return value description |
| 98 | + * @thread_safety Thread-safe / Not thread-safe |
| 99 | + */ |
| 100 | +auto function(int param) -> int; |
| 101 | +``` |
| 102 | +
|
| 103 | +## Testing |
| 104 | +
|
| 105 | +### Test Requirements |
| 106 | +
|
| 107 | +All code contributions must include tests: |
| 108 | +
|
| 109 | +- **Unit tests**: Test individual components |
| 110 | +- **Integration tests**: Test component interactions |
| 111 | +- **Platform tests**: Test platform-specific code paths |
| 112 | +
|
| 113 | +### Writing Tests |
| 114 | +
|
| 115 | +Use Google Test framework: |
| 116 | +
|
| 117 | +```cpp |
| 118 | +#include <gtest/gtest.h> |
| 119 | +
|
| 120 | +TEST(ComponentTest, BasicFunctionality) { |
| 121 | + // Test implementation |
| 122 | +} |
| 123 | +``` |
| 124 | + |
| 125 | +### Test Coverage |
| 126 | + |
| 127 | +Aim for: |
| 128 | +- New code: > 80% coverage |
| 129 | +- Critical paths: 100% coverage |
| 130 | +- Error handling: Test failure scenarios |
| 131 | + |
| 132 | +## Pull Requests |
| 133 | + |
| 134 | +### PR Checklist |
| 135 | + |
| 136 | +Before submitting a PR, ensure: |
| 137 | + |
| 138 | +- [ ] Code compiles without warnings |
| 139 | +- [ ] All tests pass |
| 140 | +- [ ] New tests added for new functionality |
| 141 | +- [ ] Documentation updated |
| 142 | +- [ ] Code follows project style |
| 143 | +- [ ] Commit messages follow conventional format |
| 144 | +- [ ] No merge conflicts with main branch |
| 145 | + |
| 146 | +### Review Process |
| 147 | + |
| 148 | +1. Automated checks run (build, tests, linting) |
| 149 | +2. Maintainer reviews code |
| 150 | +3. Address review comments |
| 151 | +4. Approved PR is merged (squash merge preferred) |
| 152 | + |
| 153 | +## Getting Help |
| 154 | + |
| 155 | +- Check [existing issues](https://github.com/kcenon/container_system/issues) |
| 156 | +- Open a [discussion](https://github.com/kcenon/container_system/discussions) for questions |
| 157 | + |
| 158 | +## License |
| 159 | + |
| 160 | +By contributing, you agree that your contributions will be licensed under the BSD 3-Clause License. |
0 commit comments