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
|
|
|
|
2021-03-05 02:35:15 +03:00
|
|
|
FILES=$(find src -type f \( -iname "*.cpp" -o -iname "*.h" \))
|
2023-10-26 22:03:36 +03:00
|
|
|
QML_FILES=$(find resources/qml -type f \( -iname "*.qml" \))
|
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
|
|
|
|
|
|
|
git diff --exit-code
|
2023-10-26 22:03:36 +03:00
|
|
|
|
2024-03-16 03:24:33 +03:00
|
|
|
./scripts/includemocs.py --insert-at-end -n src
|
|
|
|
|
2023-10-26 22:03:36 +03:00
|
|
|
if command -v /usr/lib64/qt6/bin/qmllint &> /dev/null; then
|
|
|
|
/usr/lib64/qt6/bin/qmllint $QML_FILES
|
|
|
|
elif command -v /usr/lib/qt6/bin/qmllint &> /dev/null; then
|
|
|
|
/usr/lib/qt6/bin/qmllint $QML_FILES
|
|
|
|
else
|
|
|
|
echo "No qmllint found, skipping check!"
|
|
|
|
fi
|