-
Notifications
You must be signed in to change notification settings - Fork 29
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
Option to indent the shell section #39
Comments
I agree, it definitely should be indented this way. And this should be the default. Otherwise, it seriously hampers readability. I think this should be doable using textwrap from the standard library. |
I think this should work:
|
* Triple quoted strings now get reindented with the project-wide used indentation * Relative indents between lines of the string are preserved
Hey @enixmail , I think this is fixed with 0499a7f, you get your two spaces reindented properly! Note I reindent by the lowest indented element, and then relative indenting is maintained so on:
(Hard to see, but a single space before
|
With commit 0499a7f, the shell sections are now well indented, but I think that docstrings might have been affected. Using this Snakefile:
I expect to get that as output from
but currently the output is this:
|
Hey @enixmail , thanks for the follow-up. I've made a fix relating to python code but don't think we should be reindenting your docstring. If you run
You get:
Which is what i've implemented with a coming commit. Open to discussion of course! |
Another option is to reformat all triple quoted strings and not do it as black there. |
I misread PEP 257 and was under the (false) impression that the text of all the other lines within the multi-lines docstring had to be left aligned with the start of the opening triple double quotes, which is not the case. Looking at Black's issues list, docstrings seem to have fueled many discussions, I guess |
Sure! |
* Triple quoted strings now get reindented with the project-wide used indentation * Relative indents between lines of the string are preserved
With unit test As per #39 continued
This is just a suggestion, for when you'll be at the point to insert "nice to have" items.
I saw your discussion about not indenting the inside of multi-lines string shell sections
#35 (comment)
and while I understand your point of view, I was also very disappointed as I was counting on that feature.
For an obscure reason, when I started building Snakemake workflows, I used a 2 spaces indentation instead of 4, so I have several Snakefiles following this pattern:
which I was hoping
snakefmt
would fix (the indentation) this way:It could be nice to have a command line argument like
--force-shell-indent
to havesnakefmt
also adjust the indentation of the lines inside the multi-lines string shell sections.Thanks!
The text was updated successfully, but these errors were encountered: