Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 61 lines (45 sloc) 1.413 kb
fc1a98d @toton A tool for simple verification of documentation of raised exceptions
toton authored
1 # Simple sanity checking of documentation of exceptions.
2 # Usage: go to src/ and run ../check_raise
3
4 header() {
5 info=$1
6 shift
7 result=$(mktemp)
8 $* >$result
9 cw=$(wc -w $result | cut -f1 -d\ )
10 if [ "$cw" -ne "0" ]
11 then
12 echo $info
13 cat $result
14 echo
15 fi
16 }
17
18 setminus() {
19 diff --new-line-format= --unchanged-line-format= $1 $2
20 }
21
3567290 @toton Make check_raise show more suspicious places
toton authored
22 # Capitalized Raise should be rare
23 header "Interesting places:" \
24 grep -n Raise *
fc1a98d @toton A tool for simple verification of documentation of raised exceptions
toton authored
25
3567290 @toton Make check_raise show more suspicious places
toton authored
26 #header "Needs source style:" \
27 # grep -n "Invalid_argument[[:space:]]\"" *.mli
fc1a98d @toton A tool for simple verification of documentation of raised exceptions
toton authored
28
29 use_raise=$(mktemp)
30 doc_raise=$(mktemp)
31 poor_doc_raise=$(mktemp)
32
33 # Crude check for presence of exceptions in implementations and interfaces
34 grep -n raise *.ml | cut -f1 -d. | uniq >$use_raise
35 grep -n @raise *.mli | cut -f1 -d. | uniq >$doc_raise
36 grep -n raise *.mli | cut -f1 -d. | uniq >$poor_doc_raise
37
38 suspicious=$(mktemp)
39 setminus $use_raise $doc_raise >$suspicious
40
41 need_doc=$(mktemp)
42 setminus $suspicious $poor_doc_raise >$need_doc
43
3567290 @toton Make check_raise show more suspicious places
toton authored
44 header "Documentation of the following modules mentions exceptions and awaits formal @raise clauses:" \
45 setminus $suspicious $need_doc
46
47 header "The following modules need raised exceptions to be documented (quite likely):" \
48 cat $need_doc
49
50 # Look for mistakes
51
52 header "@raises instead of @raise:" \
53 grep -n @raises *
fc1a98d @toton A tool for simple verification of documentation of raised exceptions
toton authored
54
3567290 @toton Make check_raise show more suspicious places
toton authored
55 header Typos: \
56 grep -n "Invalid_arg[[:space:]]" `find . -not -name batDynArray\*`
57
58 header Typos: \
59 grep -n Invald_argument *
fc1a98d @toton A tool for simple verification of documentation of raised exceptions
toton authored
60
Something went wrong with that request. Please try again.