nheko/.ci/format.sh

31 lines
560 B
Bash
Raw Normal View History

#!/usr/bin/env sh
2017-09-24 16:08:11 +02:00
# Runs the Clang Formatter
# Return codes:
# - 1 there are files to be formatted
# - 0 everything looks fine
set -eu
2017-09-24 16:08:11 +02:00
FILES=$(find src -type f -type f \( -iname "*.cpp" -o -iname "*.h" \))
2017-09-24 16:08:11 +02:00
for f in $FILES
do
2019-09-08 17:28:26 +02:00
clang-format -i "$f"
done;
2019-09-08 17:28:26 +02:00
2021-02-02 17:50:57 +01:00
QMLFORMAT_PATH=$(command -v qmlformat || true)
2021-02-02 03:02:27 +01:00
if [ -n "$QMLFORMAT_PATH" ]; then
2021-01-26 06:03:09 +01:00
QML_FILES=$(find resources -type f -iname "*.qml")
for f in $QML_FILES
do
$QMLFORMAT_PATH -i "$f"
2021-01-26 06:03:09 +01:00
done;
else
echo "qmlformat not found; skipping qml formatting"
2021-01-26 06:03:09 +01:00
fi
2019-09-08 17:28:26 +02:00
git diff --exit-code