Einstein
Einstein copied to clipboard
An up-to-date CONTRIBUTING file is missing
@pguyot and others
What an interesting idea to introduce the clang-format runner. For some of the code, it's really great. For some of it, intentional formatting in the whitespace is completely lost. But that's ok, I can adapt.
The runner however fails when I push new code. What can I do with this information? Pulling does not give me back reformatted code. All I have is the printout of the diff protocol via the GitHub web interface: https://github.com/pguyot/Einstein/runs/5150194388?check_suite_focus=true
How do I continue from here?
The idea with enabling clang-format or similar tool in the continuous integration system is to enforce code is always formatted identically and that developers do not care about it. They only have to format before pushing code.
For this to work we need to respect the following conditions:
- running clang-format is easy for every developer and well documented;
- developers do not push to master but create pull-requests which are tested as part of CI, and style issues are fixed before PRs are merged to master.
I am sorry this was poorly documented and we should add this to a CONTRIBUTING.md file or equivalent. There are even tools that we could encourage such as pre-commit that make things even easier.
Ah, ok, so I run clang-format, then create a PR, and if that PR does not creat an error, I can apply that. In Xcode, running clang-format could be a build target.
I just fixed the style in master. With CMake, you can run:
cmake --build build --target clang-format
or
cmake --build build --target clang-format-check
to run and fix files or only check files respectively.
See #159 for pre-commit hook configuration.
Thanks, using the formatting calls via Xcode works very well!