Skip to content

Github code format

Ashar edited this page Aug 25, 2020 · 5 revisions

Clang Format Checks

We are using default code format style of clang-format, in future when Boost.uBLAS agrees to use one code format style, the code format style file named .clang-format will be added in the root of the project and our CI will be formatting and checking based on that style file.

The following codes are only affected by code formatting:

 examples/tensor/*.cpp
 tests/tensor/*.cpp
 include/numeric/ublas/tensor/*.hpp (any hpp inside tensor directory)
 include/numeric/ublas/tensor/*/*.hpp (any subdirectory inside tensor with hpp extension)

If you want to cover more areas with code formatting, please add the location to that directory in the file named code_format.yml inside of the .github/workflows directory.

In Action

When any push event occurs to the repository the code will be automatically formatted to match the style as specified in configuration files. Any force pushes the repository with the flag --force-with-lease. This forced will fail if there was a commit after the current commit. This makes sure that code formating push does overwrite any codes. The CI will fail when it fails to push, but this failure can only occur if a new commit/push was made which in turn will trigger the CI again and it will pass eventually.

NOTE: This does not format code from PR automatically but when it's merged the code will be formatted.