[PATCH v2 1/7] docs: abort when missing return or argument documention

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When a function has no associated information to one of its
arguments or its return type we report it and stop with an error.

Signed-off-by: Claudio Bley <cbley@xxxxxxxxxx>
---
 docs/apibuild.py |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/docs/apibuild.py b/docs/apibuild.py
index 9a29c42..0ca6e7c 100755
--- a/docs/apibuild.py
+++ b/docs/apibuild.py
@@ -1962,12 +1962,17 @@ class docBuilder:
         self.xref = {}
         self.index = {}
         self.basename = name
+        self.errors = 0
 
     def warning(self, msg):
         global warnings
         warnings = warnings + 1
         print msg
 
+    def error(self, msg):
+        self.errors += 1
+        print >>sys.stderr, "Error:", msg
+
     def indexString(self, id, str):
         if str == None:
             return
@@ -2185,6 +2190,8 @@ class docBuilder:
             if ret[0] != None:
                 if ret[0] == "void":
                     output.write("      <return type='void'/>\n")
+                elif ret[1] == None or ret[1] == '':
+                    self.error("Missing documentation for return of function `%s'." % name)
                 else:
                     output.write("      <return type='%s' info='%s'/>\n" % (
                              ret[0], escape(ret[1])))
@@ -2192,8 +2199,8 @@ class docBuilder:
             for param in params:
                 if param[0] == 'void':
                     continue
-                if param[2] == None:
-                    output.write("      <arg name='%s' type='%s' info=''/>\n" % (param[1], param[0]))
+                if param[2] == None or param[2] == '':
+                    self.error("Missing documentation for arg `%s' of function `%s'." % (name, param[1]))
                 else:
                     output.write("      <arg name='%s' type='%s' info='%s'/>\n" % (param[1], param[0], escape(param[2])))
                     self.indexString(name, param[2])
@@ -2462,6 +2469,10 @@ class docBuilder:
         output.write("</api>\n")
         output.close()
 
+        if self.errors > 0:
+            print >>sys.stderr, "apibuild.py: %d error(s) encountered during generation. Stop." % self.errors
+            sys.exit(3)
+
         filename = "%s/%s-refs.xml" % (self.path, self.name)
         if not quiet:
             print "Saving XML Cross References %s" % (filename)
-- 
1.7.9.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]