The hide_undoc flag didn't work correctly. When running FORD on a project with the hide_undoc flag set to true, FORD crashes with the following traceback:
Traceback (most recent call last):
File "/home/thundermoose/ExternalGits/ford/ford.py", line 7, in <module>
run()
File "/home/thundermoose/ExternalGits/ford/ford/__init__.py", line 489, in run
main(proj_data, proj_docs)
File "/home/thundermoose/ExternalGits/ford/ford/__init__.py", line 420, in main
project.correlate()
File "/home/thundermoose/ExternalGits/ford/ford/fortran_project.py", line 343, in correlate
container.prune()
File "/home/thundermoose/ExternalGits/ford/ford/sourceform.py", line 1415, in prune
self.functions = self.filter_display(self.functions)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thundermoose/ExternalGits/ford/ford/sourceform.py", line 615, in filter_display
return [obj for obj in collection if self._should_display(obj)]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thundermoose/ExternalGits/ford/ford/sourceform.py", line 608, in _should_display
if self.settings.hide_undoc and not item.doc:
^^^^^^^^
AttributeError: 'FortranFunction' object has no attribute 'doc'
The reason this happen is that the project.correlate() function is called before the project.markdown(md) line where the doc attributes are setup. Switching order of these lines is not possible since the markdown parser md depend on project.correlate(). The solution was simple, check if the doc_list attribute is non-empty instead of checking for the doc attribute. Perhaps I should check if the items in the doc_list are not empty strings as well?
Thank you for finding and fixing this @thundermoose! Sorry for the delay in getting around to looking at it. I've added a test and simplified the check a bit.
The
hide_undoc
flag didn't work correctly. When running FORD on a project with thehide_undoc
flag set totrue
, FORD crashes with the following traceback:The reason this happen is that the
project.correlate()
function is called before theproject.markdown(md)
line where thedoc
attributes are setup. Switching order of these lines is not possible since the markdown parsermd
depend onproject.correlate()
. The solution was simple, check if thedoc_list
attribute is non-empty instead of checking for thedoc
attribute. Perhaps I should check if the items in the doc_list are not empty strings as well?