Skip to content

Update get_all_docstrings to return dict #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cldk/analysis/java/codeanalyzer/codeanalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,8 +1079,10 @@ def get_all_docstrings(self) -> List[Tuple[str, JComment]]:
Returns:
Dict[str, List[str]]: Dictionary of file paths and their corresponding docstrings.
"""
docstrings = []
docstrings = {}
for file_path, list_of_comments in self.get_all_comments().items():
docstrings += [(file_path, docstring) for docstring in list_of_comments if docstring.is_javadoc]
javadoc_comments = [docstring for docstring in list_of_comments if docstring.is_javadoc]
if javadoc_comments:
docstrings[file_path] = javadoc_comments

return docstrings
return docstrings