pydocstringformatter icon indicating copy to clipboard operation
pydocstringformatter copied to clipboard

`--max-line-length` doesn't work as expected

Open averywpx opened this issue 2 years ago • 4 comments

I ran pydocstringformatter --max-line-length=10 -w example.py on the command line, expecting pydocstringformatter will change this:

"""Hello yeeeeeeeee."""

to this:

"""Hello yeee
   eeeeee."""

But I didn't see any change. Did I do anything wrong with the command line?

averywpx avatar Oct 19 '22 16:10 averywpx

Sorry I should have responded earlier to this. This should be fixed by using the --linewrap-full-docstring option. This formatting option is not turned on by default but should wrap summaries like this!

DanielNoord avatar Nov 09 '22 19:11 DanielNoord

Using --linewrap-full-docstring only formats the summary, not the body. Is this the intended behavior?

Original docstring:

"""My docstring summary that is too long to fit in a single line.

This is the body that is longer than the summary but does not get formatted."""

Using pydocstringformatter --linewrap-full-docstring --max-line-length=30 leads to:

"""My docstring summary that
is too long to fit in a single
line.

This is the body that is longer than the summary but does not get formatted.
"""

gabrielbdsantos avatar Dec 29 '22 13:12 gabrielbdsantos

This is correct. It is much harder to wrap bodies correctly. If you have a representative code base on which you use pydocstringformatter I would be very open to using that to see how difficult it would be to wrap bodies correctly. We could add it to our list of repositories to check for each PR and see how difficult it would be to implement this.

DanielNoord avatar Dec 29 '22 21:12 DanielNoord

Being honest, I was just curious whether this was a bug or something expected. This came out while I was testing pydocstringformatter on some small projects. Nothing that could be considered a representative code base. Sorry.

gabrielbdsantos avatar Dec 29 '22 23:12 gabrielbdsantos