You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
natehardison opened this issue
Apr 25, 2023
· 0 comments
· Fixed by #190
Labels
C: styleRelates to docstring format style (e.g., Google, NumPy, Sphinx)P: bugPEP 257 violation or existing functionality that doesn't work as documented
I'm on newly-released docformatter 1.6.3. When I run on a docstring of the following format, I get an IndexError: list index out of range at File ".../lib/python3.11/site-packages/docformatter/syntax.py", line 341, in do_split_description if _lines[-1] == "":
defmethod():
"""This method doesn't do anything. https://example.com/this-is-just-a-long-url/designed-to-trigger/the-wrapping-of-the-description """
$ docformatter test.py
Traceback (most recent call last):
File "/Users/nate/testenv/bin/docformatter", line 8, in<module>sys.exit(main())
^^^^^^
File "/Users/nate/testenv/lib/python3.11/site-packages/docformatter/__main__.py", line 71, in main
return _main(
^^^^^^
File "/Users/nate/testenv/lib/python3.11/site-packages/docformatter/__main__.py", line 61, in _main
returnformator.do_format_files()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nate/testenv/lib/python3.11/site-packages/docformatter/format.py", line 158, in do_format_files
result = self._do_format_file(filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nate/testenv/lib/python3.11/site-packages/docformatter/format.py", line 191, in _do_format_file
formatted_source = self._do_format_code(source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nate/testenv/lib/python3.11/site-packages/docformatter/format.py", line 236, in _do_format_code
_code = self._format_code(source)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nate/testenv/lib/python3.11/site-packages/docformatter/format.py", line 301, in _format_code
token_string = self._do_format_docstring(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nate/testenv/lib/python3.11/site-packages/docformatter/format.py", line 393, in _do_format_docstring
return self._do_format_multiline_docstring(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nate/testenv/lib/python3.11/site-packages/docformatter/format.py", line 496, in _do_format_multiline_docstring
description = _syntax.wrap_description(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nate/testenv/lib/python3.11/site-packages/docformatter/syntax.py", line 519, in wrap_description
lines = do_split_description(text, indentation, wrap_length)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nate/testenv/lib/python3.11/site-packages/docformatter/syntax.py", line 341, in do_split_description
if _lines[-1] == "":
~~~~~~^^^^
IndexError: list index out of range
If I add any text between the summary line and the URL, then this goes away:
defmethod():
"""This docstring does not trigger an error. a https://example.com/this-is-just-a-long-url/designed-to-trigger/the-wrapping-of-the-description """
The text was updated successfully, but these errors were encountered:
weibullguy
added
P: bug
PEP 257 violation or existing functionality that doesn't work as documented
C: style
Relates to docstring format style (e.g., Google, NumPy, Sphinx)
and removed
fresh
This is a new issue
labels
Apr 25, 2023
C: styleRelates to docstring format style (e.g., Google, NumPy, Sphinx)P: bugPEP 257 violation or existing functionality that doesn't work as documented
I'm on newly-released docformatter 1.6.3. When I run on a docstring of the following format, I get an
IndexError: list index out of range
atFile ".../lib/python3.11/site-packages/docformatter/syntax.py", line 341, in do_split_description if _lines[-1] == "":
If I add any text between the summary line and the URL, then this goes away:
The text was updated successfully, but these errors were encountered: