... | ... |
@@ -67,49 +67,54 @@ |
67 | 67 |
echo $CHANGED_FILES out of $TOTAL_FILES files has been changed. |
68 | 68 |
echo $WARNED_FILES out of $TOTAL_FILES files triggered warnings. |
69 | 69 |
} |
70 | 70 |
|
71 | 71 |
function update_begin() { |
72 | 72 |
((TOTAL_FILES++)) |
73 | 73 |
CHANGED=NO |
74 | 74 |
WARNED=NO |
75 | 75 |
} |
76 | 76 |
|
77 | 77 |
function update_end() { |
78 | 78 |
if [ $CHANGED == YES ] |
79 | 79 |
then |
80 | 80 |
((++CHANGED_FILES)) |
81 | 81 |
fi |
82 | 82 |
if [ $WARNED == YES ] |
83 | 83 |
then |
84 | 84 |
((++WARNED_FILES)) |
85 | 85 |
fi |
86 | 86 |
} |
87 | 87 |
|
88 | 88 |
function check_action() { |
89 | 89 |
if [ "$3" == 'tabs' ] |
90 | 90 |
then |
91 |
|
|
91 |
if echo $2 | grep -q -v -E 'Makefile\.am$' |
|
92 |
then |
|
93 |
PATTERN=$(echo -e '\t') |
|
94 |
else |
|
95 |
PATTERN=' ' |
|
96 |
fi |
|
92 | 97 |
elif [ "$3" == 'trailing spaces' ] |
93 | 98 |
then |
94 | 99 |
PATTERN='\ +$' |
95 | 100 |
else |
96 | 101 |
PATTERN='*' |
97 | 102 |
fi |
98 | 103 |
|
99 | 104 |
if ! diff -q $1 $2 >/dev/null |
100 | 105 |
then |
101 | 106 |
if [ "$PATTERN" == '*' ] |
102 | 107 |
then |
103 | 108 |
diff $1 $2 | grep '^[0-9]' | sed "s|^\(.*\)c.*$|$2:\1: check failed: $3|g" | |
104 | 109 |
sed "s/:\([0-9]*\),\([0-9]*\):\(.*\)$/:\1:\3 (until line \2)/g" |
105 | 110 |
else |
106 | 111 |
grep -n -E "$PATTERN" $2 | sed "s|^\([0-9]*\):.*$|$2:\1: check failed: $3|g" |
107 | 112 |
fi |
108 | 113 |
FAILED=YES |
109 | 114 |
fi |
110 | 115 |
} |
111 | 116 |
|
112 | 117 |
function check_warning() { |
113 | 118 |
if [ "$2" == 'long lines' ] |
114 | 119 |
then |
115 | 120 |
grep -n -E '.{81,}' $1 | sed "s|^\([0-9]*\):.*$|$1:\1: warning: $2|g" |
0 comments (0 inline)