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
Multiline docstrings indented inconsistently on console #183
Comments
If this is considered a bug, I can take a look at providing a pull request to fix it. |
I think this is because the expectation is that you'd have symmetric docstrings of the form: @task
def example():
"""
Docstring really starts here, not on the previous line.
And so on and so forth. Now every line has the same left-margin,
which is what the indent/dedent code expects.
"""
pass I checked and while I personally find the above style far more readable and aesthetic than the
It's probably not a lot of extra code to handle the other case and I'd accept a PR for it as long as it still also handles the form I showed above :) thanks! |
I actually thought having the summary line on the same as the opening quotes was the recommended approach but apparently both styles are fine. I wonder is the code presented here available as a utility somewhere or should it just be copied: |
Yea, no idea on that last question. If there's a third party lib out there that handles it I'd be +1 to vendoring it, but it's not like that snippet you linked is very long either so we could simply drop it into a util function and tweak as (if) necessary. |
Sorry, haven't had time to look at this due to being busy with getting Robot Framework 2.8.6 release ready. One of the tasks has been writing new packaging infrastructure that includes this: It seems that the standard inspect.cleandoc function does exactly what we need. It is used by inspect.getdoc so using that instead of accessing
Once we got the RF 2.8.6 release out (hopefully today), I can take a look how to use |
Using |
Thanks for fixing this! Wouldn't have taken me much longer to figure out the exact change location and to create a test. |
If I have standard multiline docstring like
and run
invoke example
, I get this output with inconsistent documentation indentation:The text was updated successfully, but these errors were encountered: