blob: 73f8fe567f7f264cf02515ff09edcfdf104ad773 (
plain)
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
|
#!/bin/sh
#
# Does the file contain any of the code constructs deemed silly?
#
# Copyright (C) 2013, 2014-2015 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
errors=0
for x; do
case "$x" in
morphlib/licensecheck.pl) ;;
*)
if tr -cd '\t' < "$x" | grep . > /dev/null
then
echo "ERROR: $x contains TAB characters" 1>&2
grep -n -F "$(printf "\t")" "$x" 1>&2
errors=1
fi
;;
esac
case "$x" in
# Excluding yarn files since it's not possible to split up the
# IMPLEMENTS lines of them
*.yarn) ;;
morphlib/licensecheck.pl) ;;
*)
if awk 'length($0) > 79' "$x" | grep . > /dev/null
then
echo "ERROR: $x has lines longer than 79 chars" 1>&2
awk 'length($0) > 79 { print NR, $0 }' "$x" 1>&2
errors=1
fi
;;
esac
case "$x" in
*.py)
if head -1 "$x" | grep '^#!' > /dev/null
then
echo "ERROR: $x has a hashbang" 1>&2
errors=1
fi
if [ -x "$x" ]; then
echo "ERROR: $x is executable" 1>&2
errors=1
fi
if grep except: "$x"
then
echo "ERROR: $x has a bare except:" 1>&2
errors=1
fi
;;
esac
done
exit "$errors"
|