mirror of
https://github.com/irssi/irssi.git
synced 2025-04-26 04:51:11 -05:00
Created clang-format (markdown)
parent
0b61fe81e0
commit
a50abde3f3
42
clang-format.md
Normal file
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)
|
Loading…
x
Reference in New Issue
Block a user