Merge remote-tracking branch 'origin/clang-format-tool' into integration_2024_w40
This commit is contained in:
@@ -64,3 +64,7 @@ When this is done, you are set up. How to use:
|
|||||||
|
|
||||||
6) Commit. It won't work if code is not properly formatted due to the
|
6) Commit. It won't work if code is not properly formatted due to the
|
||||||
pre-commit hook. Force committing with `git commit --no-verify`
|
pre-commit hook. Force committing with `git commit --no-verify`
|
||||||
|
|
||||||
|
# Checking errors introduced by a branch
|
||||||
|
|
||||||
|
Here is the script that can be used to detect any clang-format errors introduced by a branch [here](../tools/formatting/README.md)
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Overview
|
||||||
|
|
||||||
|
Dockerized tool to list clang-format errors introduced in a branch.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
Checkout the branch you want to compare. This is necessary because if there are files added by the branch
|
||||||
|
they need to be present for clang-format to analyze them.
|
||||||
|
|
||||||
|
Then:
|
||||||
|
|
||||||
|
```
|
||||||
|
./tools/formatting/detect_clang_format_errors.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Or
|
||||||
|
|
||||||
|
```
|
||||||
|
docker compose up
|
||||||
|
```
|
||||||
|
|
||||||
|
Or (to avoid docker related lines in stdout)
|
||||||
|
|
||||||
|
```
|
||||||
|
docker compose run clang-formatter | tee output
|
||||||
|
```
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
BASE_COMMIT=$(git merge-base HEAD origin/develop)
|
||||||
|
git diff -U0 --no-color $BASE_COMMIT...HEAD | clang-format-diff -p1
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
clang-formatter:
|
||||||
|
image: clang-formatter
|
||||||
|
build:
|
||||||
|
dockerfile_inline: |
|
||||||
|
FROM ubuntu:22.04
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y git clang-format
|
||||||
|
volumes:
|
||||||
|
- ../../:/code/
|
||||||
|
command:
|
||||||
|
bash -c "git config --global --add safe.directory /code && cd /code/ && \
|
||||||
|
git config --global clangFormat.style file && \
|
||||||
|
./tools/formatting/detect_clang_format_errors.sh"
|
||||||
Reference in New Issue
Block a user