Use clang-format-13 for linting

* Update `linter.yml` to use `clang-format-13`
  * Update documentation for clang-format
This commit is contained in:
Dhruv Maroo 2021-11-23 23:45:34 +05:30 committed by Anton Kochkov
parent 59948502a7
commit 17573c17df
2 changed files with 18 additions and 11 deletions

View file

@ -67,21 +67,21 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install wget
run: sudo apt --assume-yes install wget
- name: Install wget, software-properties-common, lsb-release (dependencies of LLVM install script)
run: sudo apt --assume-yes install wget software-properties-common lsb-release
- name: Install automatic llvm (stable branch)
run: sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
- name: Install automatic LLVM 13
run: wget https://apt.llvm.org/llvm.sh -O /tmp/llvm-install.sh; chmod +x /tmp/llvm-install.sh; sudo /tmp/llvm-install.sh 13
- name: Install clang-format-11
run: sudo apt --assume-yes install clang-format-11
- name: Install clang-format-13
run: sudo apt --assume-yes install clang-format-13
- name: Install gitpython
run: sudo pip install gitpython
- name: Run clang-format
run: |
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-11 110
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-13 130
clang-format --version
python sys/clang-format.py --check --verbose

View file

@ -49,12 +49,13 @@ E.g.: `Bug fix did not change the general behavior of the function. No documenta
In order to contribute with patches or plugins, we encourage you to use the same
coding style as the rest of the code base.
* Use git-clang-format 11 to format your code. You should invoke it as below
(after making sure that your local copy of `dev` is up-to-date and your branch
is up-to-date with `dev`):
* Use git-clang-format 13 to format your code. If clang-format-13 is not available on
your Debian-based distribution, you can install it from https://apt.llvm.org/.
You should invoke it as below (after making sure that your local copy of `dev`
is up-to-date and your branch is up-to-date with `dev`):
```bash
git-clang-format-11 --extensions c,cpp,h,hpp,inc --style file dev
git-clang-format-13 --extensions c,cpp,h,hpp,inc --style file dev
```
* Lines should be at most 100 chars. A tab is considered as 8 chars. If it makes
@ -183,6 +184,12 @@ rz_core_wrap.cxx:32103:61: error: assigning to 'RzDebugReasonType' from incompat
* Never ever use `%lld` or `%llx`. This is not portable. Always use the `PFMT64x`
macros. Those are similar to the ones in GLIB. See all macroses in `librz/include/rz_types.h`.
* Add a single space after the `//` when writing inline comments:
```c
int sum = 0; // set sum to 0
```
### Shell Scripts
* Use `#!/bin/sh`