diff --git a/.gersemirc b/.gersemirc new file mode 100644 index 000000000..42fe7a3db --- /dev/null +++ b/.gersemirc @@ -0,0 +1,5 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/BlankSpruce/gersemi/0.17.0/gersemi/configuration.schema.json + +definitions: ["cmake"] +indent: 4 +line_length: 100 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fb11b0562..61cf741c6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,12 +38,12 @@ jobs: run: | python3 -m venv ./gersemi . ./gersemi/bin/activate - python3 -m pip install gersemi + python3 -m pip install gersemi==0.17 - name: Run gersemi run: | . ./gersemi/bin/activate - gersemi --line-length 100 --indent 4 --check cmake/DDCVendorConfiguration.cmake - find CMakeLists.txt tests/ examples/ benchmarks/ -name 'CMakeLists.txt' -exec gersemi --definitions $PWD/cmake --line-length 100 --indent 4 --check '{}' '+' + gersemi --check cmake/DDCVendorConfiguration.cmake + find CMakeLists.txt tests/ examples/ benchmarks/ -name 'CMakeLists.txt' -exec gersemi --check '{}' '+' id_repo: runs-on: ubuntu-latest diff --git a/README.md b/README.md index cf6dfc96f..cd4ee170e 100644 --- a/README.md +++ b/README.md @@ -37,3 +37,28 @@ cd ddc cmake -B build -D DDC_BUILD_KERNELS_FFT=OFF -D DDC_BUILD_KERNELS_SPLINES=OFF -D DDC_BUILD_PDI_WRAPPER=OFF cmake --build build ``` + +## Contributing + +### Formatting + +The project makes use of formatting tools for the C++ ([clang-format](https://clang.llvm.org/docs/ClangFormat.html)) and cmake ([gersemi](https://github.com/BlankSpruce/gersemi)) files. The formatting must be applied for a PR to be accepted. + +To format a cmake file, please apply the command + +```bash +gersemi -i the-cmake-file +``` + +One can find the formatting style in the file `.gersemirc`. + +To format a C++ file, please apply the command + +```bash +clang-format -i the-cpp-file +``` + +One can find the formatting style in the file `.clang-format`. + +> [!WARNING] +> The formatting might not give the same result with different versions of a tool.