Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions pydocstringformatter/_formatting/formatters_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ def treat_summary(
description_exists: bool,
) -> str:
"""Add a period to the end of single-line docstrings and summaries."""
if not summary:
return summary

if summary[-1] in self.END_OF_SENTENCE_PUNCTUATION:
return summary

Expand Down
3 changes: 3 additions & 0 deletions pydocstringformatter/_formatting/formatters_pep257.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ def treat_summary(
"""Split a summary and body if there is a period after the summary."""
new_summary = None

if not summary:
return summary

if _utils.is_rst_title(summary):
return summary

Expand Down
2 changes: 2 additions & 0 deletions tests/data/format/summary_splitter/regression_151.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class GithubIssue151:
""" """
2 changes: 2 additions & 0 deletions tests/data/format/summary_splitter/regression_151.py.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class GithubIssue151:
""""""