Skip to content

Commit

Permalink
doc/cicd: add more information about pre-commit/ formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
LinjingZhang committed Dec 3, 2024
1 parent 6c5d2bf commit 6c309fb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@ jobs:
run: pip install pre-commit

- name: Run pre-commit
run: pre-commit run --all-files
run: pre-commit run --all-files || true

- name: Check for formatting issues
if: failure()
run: |
echo "The following files do not meet clang-format standards:"
git diff --name-only --diff-filter=M
15 changes: 14 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,17 @@ Tests are located in tests/arduino-core-tests and included as submodule in this

## Code checks (WIP)
Refer to libraries\CAN\Makefile.codecheck
* Regarding formatting, we currently use [pre-commit](https://pre-commit.com/) to automatically run clang-formatting to format all c/c++ code. Please install this python package, and follow the quick start (the pre-commit configuration file is already there). You should be able to format your code automatically on git commit!
* Regarding formatting, we currently use [pre-commit](https://pre-commit.com/) to automatically run clang-formatting to format all c/c++ code. Please install this python package, and follow the quick start (the pre-commit configuration file is already there). You should be able to format your code automatically on git commit.
### Setting Up Pre-commit
1. Install pre-commit
```bash
pip install pre-commit
```
2. Install the pre-commit hooks:
```bash
pre-commit install
```
3. (optional) Run the hooks on all files:
```bash
pre-commit run --all-files
```

0 comments on commit 6c309fb

Please sign in to comment.