Skip to content

Commit

Permalink
Update clang-format.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
cpt-harlock authored Jan 2, 2025
1 parent 3e6c566 commit a4cb5cc
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,19 @@ jobs:
- name: Run clang-format and check code style
run: |
touch clang-format-diff.txt
a=0
for file in $(ls src/*.[ch]); do
echo $file
echo clang-format -style=file $file
clang-format -style=file $file > temp
echo diff $file temp
diff $file temp
diff=$(diff $file temp)
echo "DIFF $diff"
diff $file temp >> clang-format-diff.txt
rm temp
if [ ! -z "$diff" ]; then
echo "Style issues in $file"
clang-format -style=file "$file" | diff -u "$file" - >> clang-format-diff.txt
fi
done
echo "CIAOOA"
if [ -f clang-format-diff.txt ]; then
size=$(du src/pm.c | sed 's/\t/ /g' | cut -d' ' -f1)
if [[ ! $size -eq 0 ]]; then
echo "ERROR in format"
echo "\nThe following files have style issues:" && cat clang-format-diff.txt
echo "\nRun clang-format -i src/*.[ch] in order to fix" >> $GITHUB_OUTPUT
echo "\nRun clang-format -i src/*.[ch] in order to fix"
exit 1
else
echo "NO ERRORS"
Expand All @@ -51,4 +45,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: clang-format-diff
path: countdown/clang-format-diff.txt
path: clang-format-diff.txt

0 comments on commit a4cb5cc

Please sign in to comment.