X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b041db512dacfbae316cc83ce717d27d0f4200fb..e1bd9c56e6a6bc5f0bf6902209e1e668ac274644:/docs/find-missing.py diff --git a/docs/find-missing.py b/docs/find-missing.py index d6f80db963..4e1afee8bf 100755 --- a/docs/find-missing.py +++ b/docs/find-missing.py @@ -22,7 +22,7 @@ import xml.etree.ElementTree as ET import inspect xml_files = [ -# 'build/xml/classsimgrid_1_1s4u_1_1Activity.xml', + 'build/xml/classsimgrid_1_1s4u_1_1Activity.xml', 'build/xml/classsimgrid_1_1s4u_1_1Actor.xml', 'build/xml/classsimgrid_1_1s4u_1_1Barrier.xml', 'build/xml/classsimgrid_1_1s4u_1_1Comm.xml', @@ -61,7 +61,7 @@ def handle_python_module(fullname, englobing, elm): def found_decl(kind, obj): """Helper function that add an object in the python_decl data structure""" - if not kind in python_decl: python_decl[kind] = [] + if kind not in python_decl: python_decl[kind] = [] python_decl[kind].append(obj) @@ -106,14 +106,14 @@ for name in python_modules: for kind in python_decl: with os.popen('grep \'[[:blank:]]*auto{}::\' source/*rst|sed \'s/^.*auto{}:: //\''.format(kind, kind)) as pse: for fullname in (l.strip() for l in pse): - if not fullname in python_decl[kind]: + if fullname not in python_decl[kind]: print("Warning: {} documented but declaration not found in python.".format(fullname)) else: python_decl[kind].remove(fullname) # Dump the missing ones for kind in python_decl: for fullname in python_decl[kind]: - print("Missing decl: .. auto{}:: {}".format(kind, fullname)) + print(" .. auto{}:: {}".format(kind, fullname)) ################ And now deal with Doxygen declarations ################ @@ -122,7 +122,7 @@ doxy_funs = {} # {classname: {func_name: [args]} } doxy_vars = {} # {classname: [names]} # find the declarations in the XML files -for arg in xml_files[:1]: +for arg in xml_files[:3]: if arg[-4:] != '.xml': print ("Argument '{}' does not end with '.xml'".format(arg)) continue @@ -141,14 +141,14 @@ for arg in xml_files[:1]: kind = member.attrib["kind"] name = member.find("name").text if kind == "variable": - if not compoundname in doxy_vars: doxy_vars[compoundname] = [] + if compoundname not in doxy_vars: doxy_vars[compoundname] = [] doxy_vars[compoundname].append(name) elif kind == "function": args = member.find('argsstring').text args = re.sub('\)[^)]*$', ')', args) # ignore what's after the parameters (eg, '=0' or ' const') - if not compoundname in doxy_funs: doxy_funs[compoundname] = {} - if not name in doxy_funs[compoundname]: doxy_funs[compoundname][name] = [] + if compoundname not in doxy_funs: doxy_funs[compoundname] = {} + if name not in doxy_funs[compoundname]: doxy_funs[compoundname][name] = [] doxy_funs[compoundname][name].append(args) else: print ("member {}::{} is of kind {}".format(compoundname, name, kind)) @@ -162,28 +162,42 @@ with os.popen('grep autodoxymethod:: source/*rst|sed \'s/^.*autodoxymethod:: //\ args = "({}".format(args) (klass, obj) = line.rsplit('::', 1) - if not klass in doxy_funs: + if klass not in doxy_funs: print("Warning: {} documented, but class {} not found in doxygen.".format(line, klass)) continue - if not obj in doxy_funs[klass]: + if obj not in doxy_funs[klass]: print("Warning: Object {} documented but not found in {}".format(line, klass)) elif len(doxy_funs[klass][obj])==1: del doxy_funs[klass][obj] - elif not args in doxy_funs[klass][obj]: + elif args not in doxy_funs[klass][obj]: print("Warning: Function {}{} not found in {}".format(obj, args, klass)) else: # print("Found {} in {}".format(line, klass)) doxy_funs[klass][obj].remove(args) if len(doxy_funs[klass][obj]) == 0: del doxy_funs[klass][obj] +with os.popen('grep autodoxyvar:: source/*rst|sed \'s/^.*autodoxyvar:: //\'') as pse: + for line in (l.strip() for l in pse): + (klass, var) = line.rsplit('::', 1) + + if klass not in doxy_vars: + print("Warning: {} documented, but class {} not found in doxygen.".format(line, klass)) + continue + if var not in doxy_vars[klass]: + print("Warning: Object {} documented but not found in {}".format(line, klass)) + else: +# print("Found {} in {}".format(line, klass)) + doxy_vars[klass].remove(var) + if len(doxy_vars[klass]) == 0: + del doxy_vars[klass] # Dump the undocumented Doxygen declarations -for obj in doxy_funs: - for meth in doxy_funs[obj]: - for args in doxy_funs[obj][meth]: - print("Missing decl: .. autodoxymethod:: {}::{}{}".format(obj, meth, args)) +for obj in sorted(doxy_funs): + for meth in sorted(doxy_funs[obj]): + for args in sorted(doxy_funs[obj][meth]): + print(".. autodoxymethod:: {}::{}{}".format(obj, meth, args)) for obj in doxy_vars: - for meth in doxy_vars[obj]: - print("Missing decl: .. autodoxyfield:: {}::{}".format(obj, meth)) + for meth in sorted(doxy_vars[obj]): + print(".. autodoxyvar:: {}::{}".format(obj, meth))