Welcome to the commit and merge policy documentation page for our C++ project. This document outlines our development process, ensuring that every change is high quality, well-reviewed, and aligned with our project standards.
Overview
The commit and merge policy is designed to maintain a stable, high-quality codebase. By following these guidelines, we ensure that every commit is meaningful, every branch is purposeful, and every merge meets rigorous quality checks. This structured approach facilitates collaboration, minimizes conflicts, and helps us catch issues early in the development process.
Feature Branch Strategy
We adopt a feature branch strategy for all new developments and bug fixes. Here’s how it works:
- Fork Creation: From the main Github page of Vulpes, click on "Fork" to create your own PRIVATE fork <your-github-name>/vulpes (default options are fine).
- Branch Creation: Every new feature or bug fix should start in its own branch, created from the main branch (e.g., main or master).
- Naming Convention: Use descriptive names such as:
- feature/<feature-name> (e.g., feature/user-authentication)
- bugfix/<issue-number>-<short-description> (e.g., bugfix/123-fix-memory-leak)
- <project-type>/<project-topic>-<author-surnames-separated-by-dash> (e.g., napde/fisherprotein-Bianchi-Rossi-Smith, apsc/hadaptivity-Bianchi-Rossi-Smith, thesis/laplacian-Bianchi)
- Isolation: Working in feature branches keeps changes isolated until they are ready to be merged back, minimizing disruptions to the stable codebase.
Commit Guidelines
- Code Indentation: Always ensure your code is properly indented and formatted before each commit. Clean and consistent indentation improves readability and maintainability.
- Atomic Commits: Each commit should represent a single logical change. This approach makes it easier to review code and revert changes if necessary.
- Descriptive Commit Messages: Clearly explain what your commit does. Include references to issues or tickets when applicable.
Merge Requirements
Before a feature branch can be merged into the main branch, the following checks must be successfully completed:
- Static Analysis: The code must pass all static analysis checks to ensure code quality and catch potential issues. Static analysis is composed by: cpplint, cppcheck and clang-tidy. The latter is computationally cumbersome, and is suggested to be run seldom. The other two are insteady lightweight and we suggest a frequent usage.
- Google Test: All unit tests, executed with Google Test, must pass.
- Formatting: Code must be formatted according to our style guidelines. clang-format should be used to maintain consistency. Automatic application in ci script is available.
- Manual Code Review: At least one other team member must review the changes to confirm that they meet project standards.
- Documentation Updates: Any changes that affect functionality should include corresponding updates to documentation.
Maintaining a tidy codebase is crucial. Keeping these checks in place helps us avoid introducing bugs and maintains a high standard of code quality.
Additional Recommendations
- Continuous Integration (CI): Ensure that all commits trigger our CI pipeline to automatically run tests and checks.
- Issue Tracking: Link commits and merge requests to relevant issue tracker items for better traceability.
- Backward Compatibility: Make sure changes do not break backward compatibility unless explicitly required.
- Communication: If you’re working on a shared component or if your changes might affect others, communicate with the team early.
- Refactoring: When refactoring code, update tests and documentation accordingly to reflect changes.