mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Removed a rather confusing method by a simpler call to .__doc__
It turned out that at this point we can safely check for .__doc__ wihtout producing exceptions or false positives.
This commit is contained in:
parent
8f2f4db5ac
commit
b857b46be9
@ -187,8 +187,7 @@ class CoverageBuilder(Builder):
|
|||||||
|
|
||||||
full_attr_name = '%s.%s' % (full_name, attr_name)
|
full_attr_name = '%s.%s' % (full_name, attr_name)
|
||||||
if full_attr_name not in objects:
|
if full_attr_name not in objects:
|
||||||
if not self._is_func_undocumented(
|
if len(obj.__doc__) > 0:
|
||||||
obj, attr_name):
|
|
||||||
continue
|
continue
|
||||||
attrs.append(attr_name)
|
attrs.append(attr_name)
|
||||||
|
|
||||||
@ -198,19 +197,6 @@ class CoverageBuilder(Builder):
|
|||||||
|
|
||||||
self.py_undoc[mod_name] = {'funcs': funcs, 'classes': classes}
|
self.py_undoc[mod_name] = {'funcs': funcs, 'classes': classes}
|
||||||
|
|
||||||
def _is_func_undocumented(self, obj, attr_name):
|
|
||||||
"""Last check looking at the source code. Is function really not documented?"""
|
|
||||||
obj_source = inspect.getsource(obj) or ''
|
|
||||||
obj_source = obj_source.replace(' ', '').replace('\n', '')
|
|
||||||
if not "def%s" % attr_name in obj_source:
|
|
||||||
# Funktion is not defined in this class. No documentation needed.
|
|
||||||
return False
|
|
||||||
m = re.search('def%s\([^\)]*\):"""' %attr_name, obj_source)
|
|
||||||
if not m:
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def write_py_coverage(self):
|
def write_py_coverage(self):
|
||||||
output_file = path.join(self.outdir, 'python.txt')
|
output_file = path.join(self.outdir, 'python.txt')
|
||||||
op = open(output_file, 'w')
|
op = open(output_file, 'w')
|
||||||
|
Loading…
Reference in New Issue
Block a user