| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. sh |
| 2 | |
| 3 | # Runs the Clang Formatter |
| 4 | # Return codes: |
| 5 | # - 1 there are files to be formatted |
| 6 | # - 0 everything looks fine |
| 7 | |
| 8 | set -eu |
| 9 | |
| 10 | FILES=$(findscip-shell system . . find. src -type f \( -iname "*.cpp" -o -iname "*.h" \)) |
| 11 | QML_FILES=$(findscip-shell system . . find. resources/qml -type f \( -iname "*.qml" \)) |
| 12 | |
| 13 | for f in $FILES |
| 14 | do |
| 15 | clang-format -i "$f" |
| 16 | done; |
| 17 | |
| 18 | gitscip-shell system . . git. diff --exit-code |
| 19 | |
| 20 | ./scripts/includemocs.py --insert-at-end -n src |
| 21 | |
| 22 | if command -v /usr/lib64/qt6/bin/qmllintscip-shell filesystem . . `/usr/lib64/qt6/bin/qmllint`. &> /dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 23 | /usr/lib64/qt6/bin/qmllintscip-shell filesystem . . `/usr/lib64/qt6/bin/qmllint`. $QML_FILES |
| 24 | elif command -v /usr/lib/qt6/bin/qmllintscip-shell filesystem . . `/usr/lib/qt6/bin/qmllint`. &> /dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 25 | /usr/lib/qt6/bin/qmllintscip-shell filesystem . . `/usr/lib/qt6/bin/qmllint`. $QML_FILES |
| 26 | else |
| 27 | echoscip-shell system . . echo. "No qmllint found, skipping check!" |
| 28 | fi |