CI: check coding style of C code (!465)
This commit is contained in:
parent
4553bd705a
commit
90e2cc7eff
2 changed files with 31 additions and 0 deletions
|
@ -42,6 +42,15 @@ py-sh-static:
|
||||||
script:
|
script:
|
||||||
- .gitlab-ci/static_code_analysis.sh
|
- .gitlab-ci/static_code_analysis.sh
|
||||||
|
|
||||||
|
# coding style check
|
||||||
|
clang-format-static:
|
||||||
|
stage: first
|
||||||
|
<<: *only-default
|
||||||
|
before_script:
|
||||||
|
- apk -q add clang git
|
||||||
|
script:
|
||||||
|
- .gitlab-ci/static_clang-format.sh
|
||||||
|
|
||||||
# aports checks (generic)
|
# aports checks (generic)
|
||||||
aports-static:
|
aports-static:
|
||||||
stage: first
|
stage: first
|
||||||
|
|
22
.gitlab-ci/static_clang-format.sh
Executable file
22
.gitlab-ci/static_clang-format.sh
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
clang-format -i $(find . -name "*.c")
|
||||||
|
|
||||||
|
git diff > differences.patch
|
||||||
|
|
||||||
|
if [ -s differences.patch ]; then
|
||||||
|
echo "C-Code formatting check failed!"
|
||||||
|
echo "Please make sure, the code is formatted properly!"
|
||||||
|
echo "Run:"
|
||||||
|
echo ' clang-format -i $(find . -name "*.c")'
|
||||||
|
echo
|
||||||
|
cat differences.patch
|
||||||
|
echo
|
||||||
|
rm differences.patch
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "C-Code formatting check is sucessful!"
|
||||||
|
exit 0
|
||||||
|
fi
|
Loading…
Reference in a new issue