-
-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
pydocstringformatter v0.7.1 raises an exception on a file that looks like this
class Problematic:
""" """
passThe problem is summary.splitlines()[-1] which fails when summary is empty.
% pydocstringformatter ./problematic.py
Traceback (most recent call last):
File "/home/stuff/.pyenv/versions/stuff/bin/pydocstringformatter", line 8, in <module>
sys.exit(run_docstring_formatter())
File "/home/stuff/.pyenv/versions/3.9.11/envs/stuff/lib/python3.9/site-packages/pydocstringformatter/__init__.py", line 18, in run_docstring_formatter
_Run(argv or sys.argv[1:])
File "/home/stuff/.pyenv/versions/3.9.11/envs/stuff/lib/python3.9/site-packages/pydocstringformatter/run.py", line 32, in __init__
self.check_files(self.config.files)
File "/home/stuff/.pyenv/versions/3.9.11/envs/stuff/lib/python3.9/site-packages/pydocstringformatter/run.py", line 39, in check_files
is_changed = self.format_files(filepaths)
File "/home/stuff/.pyenv/versions/3.9.11/envs/stuff/lib/python3.9/site-packages/pydocstringformatter/run.py", line 121, in format_files
is_changed = self.format_file(file) or is_changed
File "/home/stuff/.pyenv/versions/3.9.11/envs/stuff/lib/python3.9/site-packages/pydocstringformatter/run.py", line 78, in format_file
new_tokeninfo = formatter.treat_token(new_tokeninfo)
File "/home/stuff/.pyenv/versions/3.9.11/envs/stuff/lib/python3.9/site-packages/pydocstringformatter/_formatting/base.py", line 100, in treat_token
self.treat_string(
File "/home/stuff/.pyenv/versions/3.9.11/envs/stuff/lib/python3.9/site-packages/pydocstringformatter/_formatting/base.py", line 178, in treat_string
new_summary = self.treat_summary(
File "/home/stuff/.pyenv/versions/3.9.11/envs/stuff/lib/python3.9/site-packages/pydocstringformatter/_formatting/formatters_pep257.py", line 41, in treat_summary
if _utils.is_rst_title(summary):
File "/home/stuff/.pyenv/versions/3.9.11/envs/stuff/lib/python3.9/site-packages/pydocstringformatter/_formatting/_utils.py", line 8, in is_rst_title
last_line = summary.splitlines()[-1].lstrip()
IndexError: list index out of rangeMetadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working