Skip to content

Add ':' and ';' to allowed punctuation #52

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
Feb 10, 2022
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
2 changes: 1 addition & 1 deletion pydocstringformatter/formatting/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class FinalPeriodFormatter(StringAndQuotesFormatter):
"""Add a period to the end of single line docstrings and summaries."""

name = "final-period"
END_OF_SENTENCE_PUNCTUATION = {".", "?", "!", "‽"}
END_OF_SENTENCE_PUNCTUATION = {".", "?", "!", "‽", ":", ";"}

def _treat_string(
self,
Expand Down
11 changes: 11 additions & 0 deletions tests/data/format/final_period/exotic_line_ending.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def function():
"""Check the name of first argument, expect:

*'self' for a regular method
*'cls' for a class method or a metaclass regular method"""

def function():
"""This has peculiar line ending;

but it should not matter.
"""
13 changes: 13 additions & 0 deletions tests/data/format/final_period/exotic_line_ending.py.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def function():
"""Check the name of first argument, expect:

*'self' for a regular method
*'cls' for a class method or a metaclass regular method
"""

def function():
"""This has peculiar line ending;

but it should not matter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be considered a minor issue, the spaces at the end were transformed to a newline instead of just removed.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like a Stripper issue. We can't just strip all empty lines, but an empty line as last line should be strippable.

Can you open an issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #54

"""