Created clang-format (markdown)

ailin-nemui 2020-10-26 17:27:06 +01:00
parent 0b61fe81e0
commit a50abde3f3

42
clang-format.md Normal file

@ -0,0 +1,42 @@
New code should be formatted according to .clang-format file before committing it in a pull request. ( https://clang.llvm.org/docs/ClangFormat.html )
It can be installed with `apt install clang-format` or `zypper in clang-tools`
## Checking XS files
To also correct the formatting of XS files, configure clang-format to use the clang-format-xs wrapper like so
```
git config clangformat.extensions c,h,xs
git config clangformat.binary $PWD/.github/workflows/clangformat/clang-format-xs
```
## Manual check after `git add`
Use:
```
git clang-format
```
## Auto-check format on commit
To ensure the clang-format formatting before committing, I found this tool:
https://github.com/ailin-nemui/clang-format-hooks
To use it, first clone the repo ( `git clone https://github.com/ailin-nemui/clang-format-hooks.git` )
Then, run the installer script inside your Irssi clone:
```
cd /path/to/src/irssi
../clang-format-hooks/git-pre-commit-format install
```
The next time you try to commit, the formatting will be checked!
## Emacs integration
See [Emacs](Emacs)