ci: add shell_format check
This commit is contained in:
parent
9de1bc7ba7
commit
30548ea4db
2 changed files with 27 additions and 0 deletions
|
|
@ -94,6 +94,12 @@ steps:
|
||||||
commands:
|
commands:
|
||||||
- ./tools/ci/static_analysis/cmake_format.sh
|
- ./tools/ci/static_analysis/cmake_format.sh
|
||||||
|
|
||||||
|
- name: shell format
|
||||||
|
image: ci:latest
|
||||||
|
pull: if-not-exists
|
||||||
|
commands:
|
||||||
|
- ./tools/ci/static_analysis/shell_format.sh
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
|
|
|
||||||
21
tools/ci/static_analysis/shell_format.sh
Executable file
21
tools/ci/static_analysis/shell_format.sh
Executable file
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
cd "$(git rev-parse --show-toplevel)/"
|
||||||
|
|
||||||
|
has_fomatting_issues=0
|
||||||
|
|
||||||
|
while IFS= read -r -d '' file; do
|
||||||
|
echo "Checking format for $file"
|
||||||
|
|
||||||
|
if ! shfmt -i 4 -ci -d "$file"; then
|
||||||
|
echo "❌ Formatting issue detected in $file"
|
||||||
|
has_fomatting_issues=1
|
||||||
|
fi
|
||||||
|
done < <(find ./modules ./tools -name '*.sh' -print0)
|
||||||
|
|
||||||
|
if [ "$has_fomatting_issues" -eq 0 ]; then
|
||||||
|
echo "✅ All files are properly formatted! Well done! ^~^"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit ${has_fomatting_issues}
|
||||||
Loading…
Add table
Reference in a new issue