4 This script parses the stderr output of doxygen and looks for undocumented
5 stuff. By default, it just counts the undocumented things per file. But with
6 the -A option, it rewrites the files to stick in /*DOCDOC*/ comments
7 to highlight the undocumented stuff.
15 warning_pattern
= re
.compile(r
'^([^:]+):(\d+): warning: (.*) is not documented')
17 def readDoxygenOutput(f
):
18 " yields (cfilename, lineno, thingname) "
20 m
= warning_pattern
.match(line
)
27 for fn
, lineno
, what
in list(readDoxygenOutput(sys
.stdin
)):
28 warnings
.setdefault(fn
, []).append( (int(lineno
), what
) )
31 if os
.path
.abspath(fn
) not in warnings
:
34 n
= len(warnings
[os
.path
.abspath(fn
)])
37 def getIndentation(line
):
39 return line
[:len(line
)-len(s
)]
41 def annotate(filename
):
42 if os
.path
.abspath(filename
) not in warnings
:
44 with
open(filename
) as f
:
46 w
= warnings
[os
.path
.abspath(filename
)][:]
50 for lineno
, what
in w
:
51 lineno
-= 1 # list is 0-indexed.
52 if 'DOCDOC' in lines
[lineno
]:
54 ind
= getIndentation(lines
[lineno
])
55 lines
.insert(lineno
, "%s/* DOCDOC %s */\n"%(ind
,what
))
57 shutil
.copy(filename
, filename
+".orig")
58 with
open(filename
, 'w') as f
:
63 if __name__
== '__main__':
64 if len(sys
.argv
) == 1:
65 print "Usage: locatemissingdoxygen.py [-A] filename... <doxygen_log"
68 if sys
.argv
[1] == '-A':
73 for fname
in sys
.argv
[1:]: