-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Issue Description: Standardize Clang-Format Integration and Make It Mandatory
Overview
To ensure consistent code formatting and maintain high code quality across the project, we propose introducing clang-format as a mandatory part of our development process. This will help us adhere to a unified style guide and make it easier to review code changes.
Objectives
- Standardize Code Formatting: Apply
clang-formatto ensure that all code adheres to a consistent style. - Integrate Formatting into CI/CD: Automatically check that all code complies with
clang-formatrules during the pull request (PR) process. - Enforce Formatting Rules: Prevent merges of PRs that do not comply with the formatting standards.
Implementation Steps
-
Create a
.clang-formatConfiguration File:- Define the code style rules in a
.clang-formatfile that will be used throughout the project. - The configuration should be placed in the root directory of the project.
- Define the code style rules in a
-
Apply
clang-formatto the Codebase:- Format the existing codebase using the defined
.clang-formatrules. - Commit these changes to ensure that the entire codebase is compliant.
- Format the existing codebase using the defined
-
Set Up a Pre-Commit Hook:
- Create a pre-commit hook to automatically format code before commits are finalized.
- Ensure that developers have
clang-formatinstalled locally and configure their environment to use the hook.
-
Add a CI/CD Workflow to Check Formatting:
- Create a CI/CD workflow that runs
clang-formatchecks on all PRs. - Implement a check that verifies if the code adheres to the formatting rules defined in
.clang-format. - Fail the CI/CD build if the formatting check fails, preventing the PR from being merged.
- Create a CI/CD workflow that runs
-
Documentation:
- Update the project’s contribution guidelines to include information about the
clang-formatrequirements. - Provide instructions for developers on how to set up and use
clang-formatlocally.
- Update the project’s contribution guidelines to include information about the
Checklist
- Create and commit a
.clang-formatfile. - Format existing codebase and commit changes.
- Develop and test a pre-commit hook for local formatting.
- Set up CI/CD integration for formatting checks.
- Update contribution guidelines with formatting rules and setup instructions.
- Document the process and make sure all developers are aware of the new requirements.
Additional Notes
- Dependencies: Ensure that
clang-formatis available in the build environment or specify the version required. - Exceptions: Consider scenarios where code formatting might not be strictly applicable (e.g., third-party code, generated files) and document any such exceptions.
By implementing these steps, we aim to streamline our code review process and maintain high standards of code quality throughout the project's lifecycle. Your feedback and suggestions are welcome as we work towards this integration.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request