Thank you for your interest in contributing to libcvc! This document provides guidelines for contributing to the project.
- Be respectful and inclusive
- Focus on constructive feedback
- Help maintain code quality and documentation
-
Fork and clone the repository
git clone https://github.com/transfix/libcvc.git cd libcvc -
Install dependencies (see README.md)
-
Configure for development
cmake --preset dev # or manually: cmake -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -
Build
cmake --build build -j$(nproc)
master- Stable releasesdevelop- Integration branch (if using git-flow)- Feature branches:
feature/description - Bug fixes:
fix/issue-number-description
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes
- Write clear, commented code
- Follow the existing code style
- Update documentation as needed
-
Test your changes
cmake --build build ./build/bin/libcvc # Test the executable -
Commit your changes
git add . git commit -m "Brief description of changes"
Use clear, descriptive commit messages:
Short summary (50 chars or less)
More detailed explanation if needed. Wrap at 72 characters.
Explain what and why, not how (code shows how).
- Bullet points are fine
- Use present tense ("Add feature" not "Added feature")
- Reference issues: "Fixes #123" or "Relates to #456"
Examples:
Add bilateral filter support for 16-bit volumes
Update CMake to use modern target-based linking
Fix memory leak in geometry loader
Fixes #42
-
Naming Conventions
class MyClass { }; // PascalCase for classes void my_function(); // snake_case for functions int my_variable; // snake_case for variables const int MY_CONSTANT = 42; // UPPER_CASE for constants
-
Formatting
- Use 2 spaces for indentation (matching existing code)
- Opening braces on same line for functions/classes
- Use meaningful variable names
- Avoid overly long lines (prefer <100 chars)
-
Modern C++ Practices
// Use smart pointers instead of raw pointers std::unique_ptr<MyClass> obj = std::make_unique<MyClass>(); // Use auto for complex types auto iter = container.begin(); // Use nullptr instead of NULL MyClass* ptr = nullptr; // Use range-based for loops for (const auto& item : container) { // ... }
-
Comments
/** * Brief description of function * * @param volume Input volume data * @param threshold Threshold value for processing * @return Processed geometry */ geometry process_volume(const volume& volume, double threshold);
-
Commands in lowercase
add_library(mylib source.cpp) # Good ADD_LIBRARY(mylib source.cpp) # Avoid
-
Use target-based commands
# Modern approach target_include_directories(mylib PUBLIC inc/) target_link_libraries(mylib PUBLIC Boost::filesystem) # Avoid global commands # include_directories(inc/) # Don't do this
-
Option naming
option(CVC_FEATURE_NAME "Description of feature" OFF)
When the test framework is added:
- Create tests in
test/directory - Name test files
test_<feature>.cpp - Ensure all tests pass before committing
- Add tests for bug fixes to prevent regression
Example test structure (Catch2):
#include <catch2/catch.hpp>
#include <cvc/volume/volume.h>
TEST_CASE("Volume loading", "[volume][io]") {
SECTION("Load RAWIV file") {
cvc::volume vol("test_data/sample.rawiv");
REQUIRE(vol.is_valid());
REQUIRE(vol.dimension().width() == 256);
}
}- Document all public APIs with Doxygen-style comments
- Explain complex algorithms with inline comments
- Update header file comments when changing interfaces
- Update README.md for user-facing changes
- Add examples for new features
-
Before submitting
- Ensure code compiles without warnings
- Test on your platform
- Update documentation
- Check code style matches project conventions
-
Create pull request
- Provide clear description of changes
- Reference related issues
- List any breaking changes
- Note any new dependencies
-
PR Review
- Address reviewer feedback
- Keep PR focused (one feature/fix per PR)
- Be patient and respectful
-
After merge
- Delete your feature branch
- Update your local repository
-
Unit Tests - Critical for code quality
- Choose framework (Catch2 or Google Test)
- Set up test infrastructure
- Add tests for core functionality
-
Documentation
- API documentation (Doxygen)
- Usage examples
- Tutorial guides
-
Bug Fixes
- Address known issues
- Fix memory leaks
- Improve error handling
-
Code Modernization
- Address TODO comments
- Refactor duplicate code (e.g., VolMagick)
- Implement CUDA kernels (infrastructure ready)
-
New Features
- Additional file format support
- New filtering algorithms
- Performance optimizations
-
Platform Support
- Test on various platforms
- Fix platform-specific issues
- Improve cross-platform compatibility
-
CI/CD
- GitHub Actions workflows
- Automated testing
- Code coverage reports
-
Packaging
- Debian/Ubuntu packages
- Homebrew formula
- vcpkg port
When Doxygen is set up:
cd build
cmake .. -DBUILD_DOCUMENTATION=ON
make doc
# Open build/doc/html/index.html- Open an issue for bugs or feature requests
- Tag issues with appropriate labels
- Be as specific as possible
By contributing, you agree that your contributions will be licensed under the project's license, the GNU Lesser General Public License, version 2.1 (LGPL-2.1).
Contributors will be acknowledged in release notes and documentation.
Thank you for helping improve libcvc!