-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
pre-commit
59 lines (45 loc) · 1023 Bytes
/
pre-commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# RUN: dart run grinder install-git-hooks
status=0
rm test/_coverage.dart
#flutter analyze
#status_analyze=$?
dart fix --dry-run .
status_fix=$?
if [ $status_fix -ne 0 ]; then
dart fix --apply
fi
dart format -l 120 --set-exit-if-changed .
status_format=$?
dart run grinder sort-translations
status_loc=$?
echo " "
echo "Summary:"
#if [ $status_analyze -ne 0 ]; then
# echo "[x] flutter analyze - failed (ignored by now)."
# status=1
#else
# echo "[+] flutter analyze - passed."
#fi
if [ $status_fix -ne 0 ]; then
echo "[x] dart fix - failed."
status=1
else
echo "[+] dart fix - passed."
fi
if [ $status_format -ne 0 ]; then
echo "[x] dart format - failed."
status=1
else
echo "[+] dart format - passed."
fi
if [ $status_loc -ne 0 ]; then
echo "[x] dart run grinder sort-translations - failed."
status=1
else
echo "[+] dart run grinder sort-translations - passed."
fi
if [ $status -ne 0 ]; then
echo "ERROR: Checks failures above and fix before committing."
fi
exit $status