Skip to content

Latest commit

 

History

History
160 lines (114 loc) · 3.47 KB

File metadata and controls

160 lines (114 loc) · 3.47 KB

Contributing to Common System

Thank you for considering contributing to Common System! This document provides guidelines and instructions for contributors.

Table of Contents

Getting Started

Prerequisites

  • C++20 compatible compiler (GCC 13+, Clang 16+, MSVC 2022+)
  • CMake 3.20 or higher
  • Git
  • vcpkg (recommended)

Building from Source

git clone https://github.com/kcenon/common_system.git
cd common_system
cmake --preset default
cmake --build build

Running Tests

cd build
ctest --output-on-failure

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Make your changes
  4. Run tests and ensure they pass
  5. Commit your changes (see commit message guidelines below)
  6. Push to your fork (git push origin feature/your-feature)
  7. Open a Pull Request

Commit Message Guidelines

Follow the Conventional Commits format:

<type>(<scope>): <description>

[optional body]

[optional footer]

Types:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation changes
  • refactor: Code refactoring
  • test: Adding or modifying tests
  • perf: Performance improvement
  • chore: Maintenance tasks

Code Standards

C++ Style

  • Use C++20 features when beneficial
  • Follow existing code style (clang-format configuration provided)
  • Prefer RAII for resource management
  • Use auto for obvious types
  • Avoid raw pointers; use smart pointers
  • Prefer standard library over custom implementations

Naming Conventions

  • Classes/Structs: snake_case
  • Functions/Methods: snake_case
  • Variables: snake_case
  • Constants: UPPER_SNAKE_CASE
  • Template Parameters: PascalCase
  • Namespaces: kcenon::common

Documentation

Use Doxygen-style comments:

/**
 * @brief Brief description
 * @param param Parameter description
 * @return Return value description
 * @thread_safety Thread-safe / Not thread-safe
 */
auto function(int param) -> int;

Testing

Test Requirements

All code contributions must include tests:

  • Unit tests: Test individual components
  • Integration tests: Test component interactions
  • Platform tests: Test platform-specific code paths

Writing Tests

Use Google Test framework:

#include <gtest/gtest.h>

TEST(ComponentTest, BasicFunctionality) {
    // Test implementation
}

Test Coverage

Aim for:

  • New code: > 80% coverage
  • Critical paths: 100% coverage
  • Error handling: Test failure scenarios

Pull Requests

PR Checklist

Before submitting a PR, ensure:

  • Code compiles without warnings
  • All tests pass
  • New tests added for new functionality
  • Documentation updated
  • Code follows project style
  • Commit messages follow conventional format
  • No merge conflicts with main branch

Review Process

  1. Automated checks run (build, tests, linting)
  2. Maintainer reviews code
  3. Address review comments
  4. Approved PR is merged (squash merge preferred)

Getting Help

License

By contributing, you agree that your contributions will be licensed under the BSD 3-Clause License.