Skip to content

Commit a0fbdbd

Browse files
authored
Merge pull request #168 from Solmath/feature/pre-commit-code-formatting
Code formatting and pre-commit support
2 parents cbf6ae3 + 8ad5e16 commit a0fbdbd

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

.clang-format

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
BasedOnStyle: Microsoft
3+
AllowAllArgumentsOnNextLine: 'false'
4+
AllowAllParametersOfDeclarationOnNextLine: 'false'
5+
BinPackArguments: 'false'
6+
BinPackParameters: 'false'
7+
ColumnLimit: '102'
8+
ExperimentalAutoDetectBinPacking: 'false'
9+
IndentWidth: '2'
10+
Language: Cpp
11+
# Force pointers to the type for C++.
12+
DerivePointerAlignment: 'true'
13+
PointerAlignment: Right
14+
15+
...

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- repo: https://github.com/pre-commit/mirrors-clang-format
9+
rev: v21.1.2
10+
hooks:
11+
- id: clang-format
12+
types_or: [c++, c]
13+
exclude: lib/

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,15 @@ curl http://your-server/api/clearstorage
530530
- Build frontend using `Docker`
531531
- From the root of the repo, run `docker compose run node`
532532

533+
- Please use the provided pre-commit hooks
534+
535+
- Install [pre-commit](https://pre-commit.com/)
536+
- Activate the hooks by running
537+
538+
```bash
539+
pre-commit install
540+
```
541+
533542
# Plugin Development
534543

535544
1. Start by creating a new C++ file for your plugin. For example, let's call it plugins/MyPlugin.(cpp/h).

0 commit comments

Comments
 (0)