mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-05 16:57:56 +00:00
add clang-format pre-commit hook (#4599)
* Add a new YAML file (.pre-commit-config.yaml) to set up pre-commit
hook for clang-format
* The pre-commit hook is opt-in and needs to be installed in order to
run automatically
* Update CONTRIBUTING.md with instructions on how to set up and use the
clang-format linter
Automating the process of running clang-format before committing code
helps to save time by removing the need to fix formatting issues later.
This is a tooling improvement and doesn't change C++ code.
This commit is contained in:
6
.pre-commit-config.yaml
Normal file
6
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# .pre-commit-config.yaml
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||||
|
rev: v10.0.1
|
||||||
|
hooks:
|
||||||
|
- id: clang-format
|
||||||
@@ -121,6 +121,11 @@ this:
|
|||||||
You can format individual files in place by running `clang-format -i <file>...`
|
You can format individual files in place by running `clang-format -i <file>...`
|
||||||
from any directory within this project.
|
from any directory within this project.
|
||||||
|
|
||||||
|
You can install a pre-commit hook to automatically run `clang-format` before every commit:
|
||||||
|
```
|
||||||
|
pip3 install pre-commit
|
||||||
|
pre-commit install
|
||||||
|
```
|
||||||
|
|
||||||
## Avoid
|
## Avoid
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user