Thanks for your interest in contributing! This guide will help you get started.
- Fork and clone the repository
- Create a new branch:
git checkout -b my-fix - Make your changes
- Build:
make(this also installs git hooks automatically) - Commit and push (the git commit hook will check formatting and lint)
- Open a pull request
You'll need:
- A C compiler (GCC or Clang)
makefor buildingclang-formatandclang-tidyfor code quality checks
macOS:
brew install llvmThe Makefile automatically finds the tools from Homebrew's LLVM installation - no need to modify your PATH.
Ubuntu / Debian:
sudo apt-get install clang-format clang-tidyArch Linux:
sudo pacman -S clangFedora:
sudo dnf install clang-tools-extra| Command | Description |
|---|---|
make |
Build all exercises |
make format |
Format all code |
make format-check |
Check formatting (used by CI) |
make lint |
Run linter checks |
make check |
Run all checks (format + lint) |
make install-hooks |
Install git pre-commit hook (runs automatically) |
make clean |
Remove compiled files |
Git hooks are installed automatically when you run make, so formatting and linting checks will run before each commit.
You can also run checks manually:
make format # Format your code
make check # Run all checksThe CI will automatically check formatting and linting on your pull request.
We use clang-format with minimal configuration (LLVM style, 4-space indentation). Just run make format and your code will be properly formatted.
Additional rules enforced by clang-tidy:
Declare each variable on its own line for better readability.
// ✗ Avoid
int x, y, z;
float fahr, celsius;
// ✓ Preferred
int x;
int y;
int z;
float fahr;
float celsius;- Bug fixes - Found an error in a solution? Please fix it!
- Improvements - Better algorithms, clearer code, or better comments
- Missing solutions - Some exercises may be missing solutions
- Documentation - Improve explanations or add helpful comments
Feel free to open an issue if you have questions or need help!