Skip to content

Commit

Permalink
ci: add clang-format to check-format and enforce
Browse files Browse the repository at this point in the history
problem: we don't automatically check c/c++ formatting on push

solution: add clang-format to the check-format script

I also renamed "python formatting" to "code formatting" here so that
would stay accurate
  • Loading branch information
trws committed Jul 8, 2024
1 parent af44d3b commit 9a85cda
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
uses: crate-ci/typos@bcafd462cb07ef7ba57e34abf458fe20767e808b # v1.19.0

python-format:
name: python format
runs-on: ubuntu-20.04
name: code formatting
runs-on: ubuntu-24.04
steps:
- uses: actions/setup-python@v5
with:
Expand Down
7 changes: 7 additions & 0 deletions scripts/check-format
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ if command -v black 2>&1 > /dev/null ; then
# awk cmd copied from:
# https://unix.stackexchange.com/questions/66097/find-all-files-with-a-python-shebang
find src t -path "src/python/fluxion/jsongraph" -prune -o \
-path "t/python/pycotap" -prune -o \
-type f \( -name "*.py" -print -o \
-exec awk ' /^#!.*python/{print FILENAME} {nextfile}' {} + \) \
| xargs black --check --diff
else
echo "black not found, failing"
exit 1
fi

find resource qmanager src/ -name '*.h' -o -name '*.c' -o -name '*.cpp' -o -name '*.hpp' |
grep -v yggdrasil |
grep -v 'json.hpp' |
grep -v libtap |
xargs -P 8 -n 1 clang-format --dry-run --Werror

0 comments on commit 9a85cda

Please sign in to comment.