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