diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7e121501..295cd15a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,13 +24,19 @@ The above environment provides you with: Alternatively, please refer to our official docs for [download, build, and install instructions](https://mpusz.github.io/units/usage.html) if you want to setup a development environment on your local machine. -## Where to start? +## Code Formatting -If you are looking for a good issue to start with, please check the following: +There is a formatting standard enforced with the `pre-commit` script. Before committing your changes please do the following: + +```bash +pip3 install -U pre-commit +pre-commit run --all-files +``` + +This will run `clang-format` for code formatting with the `.clang-format` file provided in the repo, `cmake-format` to format the CMake files, and some other check as well. +The script will run on all the files in the repo and will apply the changes in-place when needed. +After the script is done please make sure to stage all those changes to git commit. -- [good first issue](https://github.com/mpusz/units/labels/good%20first%20issue) - issues that should be pretty simple to implement. -- [help wanted](https://github.com/mpusz/units/labels/help%20wanted) - issues that typically are a bit more involved than beginner issues. -- [high priority](https://github.com/mpusz/units/labels/high%20priority) - things to fix ASAP but often of higher complexity. ## Naming Conventions @@ -40,18 +46,6 @@ Here are the main rules for naming things in this repo: - template parameters in a `PascalCase` - C++20 concepts names for now in a `PascalCase` but we plan to change it (see for more details) -## Code Formatting - -Please use `clang-format-15` for code formatting with the `.clang-format` file provided in the repo. - -If you are unable to install or use `clang-format-15`, here are the main rules to follow: - -- LF line endings -- 2 spaces for indentation - - `requires` clause indented with 2 spaces as well -- no indentation for namespaces -- function opening brace in the new line - - all other opening braces attached to the current context at the end of the same line ## Backward Compatibility @@ -59,3 +53,12 @@ Before submission, please remember to check if the code compiles fine on the sup The CI will check it anyway but it is good to check at least some of the configurations before pushing changes. Especially older compilers can be tricky as those do not support all the C++20 features well enough. The official list of supported compilers can be always found on our [Usage page](https://mpusz.github.io/units/usage.html). + + +## Where to start? + +If you are looking for a good issue to start with, please check the following: + +- [good first issue](https://github.com/mpusz/units/labels/good%20first%20issue) - issues that should be pretty simple to implement. +- [help wanted](https://github.com/mpusz/units/labels/help%20wanted) - issues that typically are a bit more involved than beginner issues. +- [high priority](https://github.com/mpusz/units/labels/high%20priority) - things to fix ASAP but often of higher complexity.