Commit b8401a18 authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/clang-format-tool' into integration_2024_w40

parents a700da57 771d11a1
......@@ -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
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)
# 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
```
#!/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
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"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment