-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
#ignore merges | ||
isMerge=$(git rev-parse -q --verify MERGE_HEAD) | ||
if [ -n "$isMerge" ]; then | ||
exit | ||
fi | ||
|
||
# fix with linter | ||
dart fix --apply | ||
|
||
# Regexp for grep to only choose some file extensions for formatting | ||
exts="\.\(dart\)$" | ||
echo "Pre-commit: formatting changed files" | ||
# Format staged files | ||
for file in $(git diff --cached --name-only --diff-filter=ACMR | grep $exts); do | ||
echo "Formatting $file" | ||
dart format --line-length=120 $file | ||
git add $file | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
printf "\e[33;1m%s\e[0m\n" 'Running the Flutter analyzer' | ||
flutter analyze | ||
if [ $? -ne 0 ]; then | ||
printf "\e[31;1m%s\e[0m\n" 'Flutter analyzer error' | ||
exit 1 | ||
fi | ||
printf "\e[33;1m%s\e[0m\n" 'Finished running the Flutter analyzer' | ||
|
||
printf "\e[33;1m%s\e[0m\n" 'Running unit tests' | ||
flutter test | ||
if [ $? -ne 0 ]; then | ||
printf "\e[31;1m%s\e[0m\n" 'Unit tests error' | ||
exit 1 | ||
fi | ||
printf "\e[33;1m%s\e[0m\n" 'Finished running unit tests' |