-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanup.sh
141 lines (124 loc) · 2.75 KB
/
cleanup.sh
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
# JADE
echo "=> Converting jade to compiled js runtime functions"
cd templates
bash compile_jade.sh
cd ..
clear
echo "======================="
echo "Finished compiling jade"
echo "======================="
printf "\n"
read -n1 -p "=> Proceed? [y,n] " doit
printf "\n"
case $doit in
y|Y) ;;
*)
echo "ERROR: (Control/Command-C to exit and fix it)"
printf "\n"
exit ;;
esac
printf "\n"
echo "=> Checking that jade templates have wrapped lines"
for file in $(find templates -name "*.jade"); do
echo "Unwrapped lines in" $file ":"
grep -in '.\{80,\}' $file
printf "\n"
done
printf "\n"
read -n1 -p "=> Did you follow HTML CSS and Bootstrap Rules in Setup Instructions and
Code Review Guidelines? [y,n] " doit
printf "\n"
case $doit in
y|Y) ;;
*)
echo "ERROR: (Control/Command-C to exit and fix it)"
printf "\n"
exit ;;
esac
printf "\n"
# CSS
echo "=> Checking that css files have wrapped lines"
for file in $(find static/views/css -name "*.css"); do
echo "Unwrapped lines in" $file ":"
grep -in '.\{80,\}' $file
printf "\n"
done
printf "\n"
read -n1 -p "=> Does CSSLint have any complaints? [y,n] " doit
printf "\n"
case $doit in
n|N) ;;
*)
echo "ERROR: (Control/Command-C to exit and fix it)"
printf "\n"
exit ;;
esac
read -n1 -p "=> Are you sure? [y,n] " doit
printf "\n"
case $doit in
y|Y) ;;
*)
echo "ERROR: (Control/Command-C to exit and fix it)"
printf "\n"
exit ;;
esac
printf "\n"
# JS
echo "=> Remove any unnecessary instances of console.log in js files:"
grep "console.log" static/views/js/*.js
printf "\n"
read -n1 -p "=> Did you follow jQuery Coding Rules in Setup Instructions and
Code Review Guidelines? [y,n] " doit
printf "\n"
case $doit in
y|Y) ;;
*)
echo "ERROR: (Control/Command-C to exit and fix it)"
printf "\n"
exit ;;
esac
printf "\n"
read -n1 -p "=> Does JSHint have any complaints? [y,n] " doit
printf "\n"
case $doit in
n|N) ;;
*)
echo "ERROR: (Control/Command-C to exit and fix it)"
printf "\n"
exit ;;
esac
read -n1 -p "=> Are you sure? [y,n] " doit
printf "\n"
case $doit in
y|Y) ;;
*)
echo "ERROR: (Control/Command-C to exit and fix it)"
printf "\n"
exit ;;
esac
printf "\n"
# PYTHON
echo "=> Remove any unnecessary instances of print in py files:"
grep "print" *.py
grep "print" freelancer/*.py
grep "print" ocw/*.py
printf "\n"
read -n1 -p "=> Continue to autopep8 python files? [y,n] " doit
printf "\n"
case $doit in
y|Y) ;;
*)
echo "Make sure to rerun cleanup before pushing"
printf "\n"
exit ;;
esac
printf "\n"
echo "=> Formatting python code to pep8 standards"
for file in $(find . -name "*.py"); do
echo "Formatting" $file
python autopep8/autopep8.py --in-place $file
done
printf "\n"
echo "Code is clean. Ready for pushing."
printf "\n"