forked from oracle/truffleruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlint.sh
executable file
·38 lines (32 loc) · 904 Bytes
/
lint.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
#!/bin/bash
set -e
bad=$(egrep -r ',\s*@Cached' src || exit 0)
if [ -n "$bad" ]; then
echo "@Cached arguments should be on their own line"
echo "$bad"
exit 1
fi
bad=$(egrep -r '\.computeIfAbsent' src || exit 0)
if [ -n "$bad" ]; then
echo "Use ConcurrentOperations.getOrCompute() instead of ConcurrentHashMap.computeIfAbsent() which does not scale"
echo "$bad"
exit 1
fi
bad=$(ruby -e 'puts STDIN.read.scan /^.+\)\s*\n\s*\{/' < src/main/c/cext/ruby.c || exit 0)
if [ -n "$bad" ]; then
echo "The function definition opening brace should be on the same line: ...args) {"
echo "$bad"
exit 1
fi
bad=$(egrep '\)\{' src/main/c/cext/ruby.c || exit 0)
if [ -n "$bad" ]; then
echo "There should be a space between ) and {"
echo "$bad"
exit 1
fi
bad=$(egrep '\bif\(' src/main/c/cext/ruby.c || exit 0)
if [ -n "$bad" ]; then
echo "There should be a space between if and ("
echo "$bad"
exit 1
fi