]
opencv_module_list = [
-#"core",
-#"imgproc",
-#"calib3d",
-#"features2d",
-#"video",
-#"objdetect",
-#"highgui",
+"core",
+"imgproc",
+"calib3d",
+"features2d",
+"video",
+"objdetect",
+"highgui",
"ml"
]
class RSTParser(object):
+
+ def __init__(self):
+ self.read_whitelist()
+
+ # reads the file containing functions and classes that do not need to be documented
+ def read_whitelist(self):
+ self.whitelist = {}
+ try:
+ wf = open("check_docs_whitelist.txt", "rt")
+ except IOError:
+ return
+ self.parser = hp.CppHeaderParser()
+
+ for l in wf.readlines():
+ cpos = l.find("#")
+ if cpos >= 0:
+ l = l[:cpos]
+ l = l.strip()
+ if not l:
+ continue
+ rst_decl = None
+ if "(" in l:
+ rst_decl = self.parser.parse_func_decl_no_wrap(l)
+ fname = rst_decl[0]
+ else:
+ fname = l.replace("::", ".")
+ complist = fname.split(".")
+ prefix = ""
+ alreadyListed = False
+ wl = []
+ for c in complist:
+ prefix = (prefix + "." + c).lstrip(".")
+ wl = self.whitelist.get(prefix, [])
+ if wl == "*":
+ break
+ if wl == "*":
+ continue
+ if not rst_decl:
+ self.whitelist[fname] = "*"
+ else:
+ wl.append(rst_decl)
+ self.whitelist[fname] = wl
+ wf.close()
def process_rst(self, docname):
df = open(docname, "rt")
print "Documented function %s in %s:%d does not have a match" % (fdecl, docname, lineno)
df.close()
+ def decl2str(self, decl):
+ return "%s %s(%s)" % (decl[1], decl[0], ", ".join([a[0] + " " + a[1] for a in decl[3]]))
+
def check_module_docs(self, name):
self.parser = hp.CppHeaderParser()
decls = []
if hname.startswith("../modules/" + name):
decls += self.parser.parse(hname, wmode=False)
- #parser.print_decls(decls)
-
for d in decls:
fname = d[0]
if not fname.startswith("struct") and not fname.startswith("class") and not fname.startswith("const"):
misscount = 0
fkeys = sorted(self.fmap.keys())
for f in fkeys:
+ # skip undocumented destructors
+ if "~" in f:
+ continue
decls = self.fmap[f]
+ fcomps = f.split(".")
+ prefix = ""
+ wlist_decls = []
+ for c in fcomps:
+ prefix = (prefix + "." + c).lstrip(".")
+ wlist_decls = self.whitelist.get(prefix, [])
+ if wlist_decls == "*":
+ break
+ if wlist_decls == "*":
+ continue
+ wlist_decls = [self.decl2str(d) for d in wlist_decls]
+
for d in decls:
- misscount += 1
- print "%s %s(%s)" % (d[1], d[0], ", ".join([a[0] + " " + a[1] for a in d[3]]))
+ dstr = self.decl2str(d)
+ if dstr not in wlist_decls:
+ misscount += 1
+ print "%s %s(%s)" % (d[1], d[0].replace(".", "::"), ", ".join([a[0] + " " + a[1] for a in d[3]]))
print "\n\n\nundocumented functions in %s: %d" % (name, misscount)
-
+
+
p = RSTParser()
for m in opencv_module_list:
print "\n\n*************************** " + m + " *************************\n"
--- /dev/null
+# this is a list of functions, classes and methods
+# that are not supposed to be documented in the near future,
+# to make the output of check_docs.py script more sensible.
+#
+# Syntax:
+# every line starting with # is a comment
+# there can be empty lines
+# each line includes either a class name (including all the necessary namespaces),
+# or a function/method name
+# or a full declaration of a function/method
+# if a class name is in the whitelist, all the methods are considered "white-listed" too
+# if a method/function name is listed, then all the overload variants are "white-listed".
+# that is, to white list a particular overloaded variant of a function/method you need to put
+# full declaration into the file
+#
+
+cv::Mat::MSize
+cv::Mat::MStep
+cv::Algorithm
+cv::_InputArray
+cv::_OutputArray
+
+CvLevMarq
+