feat: Add the check-pr script

This commit is contained in:
PapaTutuWawa committed 2023-07-24 18:37:03 +02:00
1 parent 92687b6513
commit 3e2f63478c
2 files changed
+40

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
# Run before merging a PR. Checks if the formatting is correct.
# Check if there are any formatting issues
echo "Checking formatting..."
dart_format_result=$(dart format --output none --set-exit-if-changed .)
if [[ ! "$?" = "0" ]]; then
echo "Error: dart format indicates that format the code is not formatted properly"
echo
echo "dart format output:"
echo "$dart_format_result"
exit 1
fi
# Check if the linter has any issues
echo "Checking linter..."
flutter_analyze_result=$(flutter analyze)
if [[ ! "$?" = "0" ]]; then
echo "Error: flutter analyze indicates that there are lint issues"
echo
echo "flutter analyze output:"
echo "${flutter_analyze_result}"
exit 1
fi
echo "PR looks good!"