Skip to content

Commit

Permalink
Check for clang-format issues in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
movermeyer committed Dec 6, 2022
1 parent 5193dfc commit 7710327
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ workflows:
parameters:
python_version: ["2.7", "3.7", "3.8", "3.9"]
- lint-rst
- clang-format

jobs:
# `cimg/python` doesn't support Python 3.4,
Expand Down Expand Up @@ -67,3 +68,27 @@ jobs:
rst-lint --encoding=utf-8 README.rst
docker:
- image: cimg/python:3.11

clang-format:
working_directory: ~/code
steps:
- checkout
- run:
name: Install lint tools
command: |
sudo apt-get update -y
sudo apt-get install -y clang-format
- run:
name: Lint
command: |
SOURCE_FILES=`find ./ -name \*.c -type f -or -name \*.h -type f`
for SOURCE_FILE in $SOURCE_FILES
do
export FORMATTING_ISSUE_COUNT=`clang-format -output-replacements-xml $SOURCE_FILE | grep offset | wc -l`
if [ "$FORMATTING_ISSUE_COUNT" -gt "0" ]; then
echo "Source file $SOURCE_FILE contains formatting issues. Please use clang-format tool to resolve found issues."
exit 1
fi
done
docker:
- image: cimg/python:3.11

0 comments on commit 7710327

Please sign in to comment.