16
16
import glob
17
17
18
18
from utilities import (TestCase ,
19
- unittest )
19
+ unittest ,
20
+ printImportant )
20
21
21
22
try :
22
23
import xml .etree .cElementTree as ET
@@ -39,7 +40,7 @@ def elemIsDocumentableClass(elem):
39
40
if not elem .get ('kind' ) == 'class' :
40
41
return False
41
42
42
- #public or protected classes should be documented
43
+ # public or protected classes should be documented
43
44
return elem .get ('prot' ) in ('public' , 'protected' )
44
45
45
46
@@ -58,27 +59,27 @@ def elemIsDocumentableMember(elem):
58
59
if elem .get ('kind' ) == 'variable' :
59
60
return False
60
61
61
- #only public or protected members should be documented
62
+ # only public or protected members should be documented
62
63
if not elem .get ('prot' ) in ('public' , 'protected' ):
63
64
return False
64
65
65
- #ignore reimplemented methods
66
- #use two different tests, as doxygen will not detect reimplemented qt methods
66
+ # ignore reimplemented methods
67
+ # use two different tests, as doxygen will not detect reimplemented qt methods
67
68
if elem .find ('reimplements' ) is not None :
68
69
return False
69
70
args = elem .find ('argsstring' )
70
71
if args is not None and args .text and ' override' in args .text :
71
72
return False
72
73
73
- #ignore destructor
74
+ # ignore destructor
74
75
name = elem .find ('name' )
75
76
try :
76
77
if name .text and name .text .startswith ('~' ):
77
78
return False
78
79
except :
79
80
pass
80
81
81
- #ignore constructors with no arguments
82
+ # ignore constructors with no arguments
82
83
definition = elem .find ('definition' )
83
84
argsstring = elem .find ('argsstring' )
84
85
try :
@@ -87,21 +88,21 @@ def elemIsDocumentableMember(elem):
87
88
except :
88
89
pass
89
90
90
- #ignore certain obvious operators
91
+ # ignore certain obvious operators
91
92
try :
92
93
if name .text in ('operator=' , 'operator==' ):
93
94
return False
94
95
except :
95
96
pass
96
97
97
- #ignore on_* slots
98
+ # ignore on_* slots
98
99
try :
99
100
if name .text .startswith ('on_' ):
100
101
return False
101
102
except :
102
103
pass
103
104
104
- #ignore deprecated members
105
+ # ignore deprecated members
105
106
typeelem = elem .find ('type' )
106
107
try :
107
108
if typeelem .text and 'Q_DECL_DEPRECATED' in typeelem .text :
@@ -151,7 +152,7 @@ def parseFile(f):
151
152
print "\n "
152
153
elem .clear ()
153
154
except ET .ParseError as e :
154
- #sometimes Doxygen generates malformed xml (eg for < and > operators)
155
+ # sometimes Doxygen generates malformed xml (eg for < and > operators)
155
156
line_num , col = e .position
156
157
with open (f , 'r' ) as xml_file :
157
158
for i , l in enumerate (xml_file ):
@@ -186,11 +187,11 @@ def testCoverage(self):
186
187
missing = documentable - documented
187
188
188
189
print "---------------------------------"
189
- print "{} total documentable members" .format (documentable )
190
- print "{} total contain valid documentation" .format (documented )
191
- print "Total documentation coverage {}%" .format (coverage )
192
- print "---------------------------------"
193
- print "{} members missing documentation, out of {} allowed" .format (missing , ACCEPTABLE_MISSING_DOCS )
190
+ printImportant ( "{} total documentable members" .format (documentable ) )
191
+ printImportant ( "{} total contain valid documentation" .format (documented ) )
192
+ printImportant ( "Total documentation coverage {}%" .format (coverage ) )
193
+ printImportant ( "---------------------------------" )
194
+ printImportant ( "{} members missing documentation, out of {} allowed" .format (missing , ACCEPTABLE_MISSING_DOCS ) )
194
195
195
196
assert missing <= ACCEPTABLE_MISSING_DOCS , 'FAIL: new undocumented members have been introduced, please add documentation for these members'
196
197
0 commit comments