Skip to content

Account for comments #94

Account for comments

Account for comments #94

Workflow file for this run

name: ClangFormat
on:
push:
branches: [main]
pull_request:
jobs:
check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Download a recent, static build of clang-format
run: |
wget --no-verbose https://github.com/angular/clang-format/raw/master/bin/linux_x64/clang-format
chmod a+x clang-format
- name: Print clang-format version
run: |
./clang-format --version
- name: Run clang-format and report result
run: |
cd src
# Parse full lines
export IFS=$'\n'
# For each file in repository with name ending with ".hpp", ".h", ".cpp" ...
for file in $(git ls-files | egrep "\\.hpp$|\\.h$|\\.cpp$"$); do
echo Formatting "$file"
# format it in place, so git can pick it up.
../clang-format -style=file -i "$file"
done
# Just some visual separation
echo -e "\\n\\n\\n\\tChecking diff...\\n\\n\\n"
# Set error mode. Makes bash bail on first non-zero exit code
set -e
# Print diff, if any and report with exit code.
git diff --exit-code
# When no diff present, provide status.
echo -e "\\tStyle is fine"