GRIDEDIT-1502 Reduce cyclomatic complexity #2872
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ClangFormat | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
jobs: | |
check: | |
runs-on: ubuntu-20.04 | |
name: Clang Format Check | |
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: | | |
# Parse full lines | |
export IFS=$'\n' | |
cd libs | |
# 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 | |
cd ../tools | |
# 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" |