Linter
Overview
This project uses ClangFormat with a fork of Google C++ Style Guide to maintain consistent code formatting across all .cpp, .hpp and .tpp files.
Ensure clang-format is installed
clang-format --version
🛠️ Usage
Auto-Format All Files
Automatically formats all .cpp, .hpp and .tpp files according to Google style:
make format
Important
This command modifies files in place. It's recommended to commit your changes before running this command!
📐 Google Style Configuration
The .clang-format file at the root of the project defines our personal rules overloading Google ones
🔄 CI/CD Integration
GitHub Actions
The workflow .github/workflows/lint.yml automatically checks formatting on:
- Every pull request where relevant files have been modified
If formatting issues are detected, the CI will fail and display the errors.
📝 Best Practices
During Development
You can configure your IDE to auto-format on save:
VS Code
- Install the "C/C++" extension
- Add to
.vscode/settings.json:
{
"editor.formatOnSave": true,
"C_Cpp.clang_format_style": "file"
}
CLion
- Go to
Settings > Editor > Code Style > C/C++ - Set "Scheme" to "file"
- Enable "Reformat code on save"