Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
autodoxy: if the meth signature does not match but only one meth is found, use it
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 10 Nov 2019 17:20:38 +0000 (18:20 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 10 Nov 2019 18:09:06 +0000 (19:09 +0100)
This tries to be more permissive to user errors. A warning is spit.

docs/source/_ext/autodoxy/autodoxy/autodoxy.py

index fd7537c..40ca007 100644 (file)
@@ -229,8 +229,14 @@ class DoxygenMethodDocumenter(DoxygenDocumenter):
             logger = logging.getLogger(__name__)
 
             if self.argsstring != None:
+                candidates = get_doxygen_root().xpath(xpath_query_noparam)
+                if len(candidates) == 1:
+                    logger.warning("[autodoxy] Using method '{}::{}{}' instead of '{}::{}{}'. You may want to drop your specification of the signature, or to fix it."
+                                   .format(obj, meth, candidates[0].find('argsstring').text, obj, meth, self.argsstring))
+                    self.object = candidates[0]
+                    return True
                 logger.warning("[autodoxy] WARNING: Could not find method {}::{}{}".format(obj, meth, self.argsstring))
-                for cand in get_doxygen_root().xpath(xpath_query_noparam):
+                for cand in candidates:
                     logger.warning("[autodoxy] WARNING:   Existing candidate: {}::{}{}".format(obj, meth, cand.find('argsstring').text))
             else:
                 logger.warning("[autodoxy] WARNING: could not find method {}::{} in Doxygen files".format(obj, meth))