diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 9be2af1d..e3ea7e8f 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -25,4 +25,10 @@ jobs: run: pip install pre-commit - name: Run pre-commit - run: pre-commit run --all-files \ No newline at end of file + 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 \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f2a91d67..83b9cefc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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! \ No newline at end of file +* 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 + ``` \ No newline at end of file