Skip to content

UGRID-43: Handle SWIGTYPE_P_<T> #299

UGRID-43: Handle SWIGTYPE_P_<T>

UGRID-43: Handle SWIGTYPE_P_<T> #299

Workflow file for this run

name: Code formatting
on:
push:
branches: [main]
pull_request:
jobs:
check:
name: ClangFormat
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install clang-format
run: sudo apt install clang-format
- name: Run clang-format and report result
run: |
declare -a directories=(
"libs/UGrid/src"
"libs/UGrid/include"
"libs/UGridAPI/src"
"libs/UGridAPI/include"
"tests"
)
# Parse full lines
export IFS=$'\n'
for directory in "${directories[@]}"; do
(
cd "${directory}"
# Format each file in the directory 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 diff can pick it up.
clang-format -style=file -i "${file}"
done
)
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"