Skip to content

Commit

Permalink
Merge pull request #651 from thundermoose/fixing-hide_undoc-bug
Browse files Browse the repository at this point in the history
Fix bug with `hide_undoc = True`
  • Loading branch information
ZedThree authored Jul 4, 2024
2 parents 8e05e45 + 0f88011 commit 4944f06
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ford/sourceform.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def find_child(

def _should_display(self, item) -> bool:
"""Return True if item should be displayed"""
if self.settings.hide_undoc and not item.doc:
if self.settings.hide_undoc and not item.doc_list:
return False
return item.permission in self.display

Expand Down
20 changes: 20 additions & 0 deletions test/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1362,3 +1362,23 @@ def test_links_in_deferred_bound_methods(copy_fortran_file):
links = {link.text: link["href"] for link in docstring.find_all("a")}
assert links["foo_t"].endswith("foo_t.html")
assert links["foo"].endswith("foo_t.html#boundprocedure-foo")


def test_hide_undoc(copy_fortran_file):
data = """\
module foo
contains
!> A subroutine with a docstring
subroutine with_doc
end subroutine with_doc
subroutine no_doc
end subroutine no_doc
end module
"""

settings = copy_fortran_file(data)
settings.hide_undoc = True
project = create_project(settings)

assert len(project.modules[0].subroutines) == 1

0 comments on commit 4944f06

Please sign in to comment.