Fix No blank line after if/for/while/def#1180
Fix No blank line after if/for/while/def#1180ashmichheda wants to merge 10 commits intogoogle:mainfrom
Conversation
yapf/__init__.py
Outdated
| source = [line.rstrip() for line in original_source] | ||
| source[0] = _removeBOM(source[0]) | ||
| # filter all the tuples with empty space | ||
| source = list(filter(None, source)) |
There was a problem hiding this comment.
I don't like this change, as it seems overly broad. For instance, if there are disabled sections, we don't want to remove the newlines from them.
There was a problem hiding this comment.
ok, thanks! Yeah, makes sense to not format the disabled sections. I'll try to see if I can prevent the commented section from filtering.
There was a problem hiding this comment.
@bwendling, I have added a util function that filters out the comment sections while removing the new lines. Kindly let me know for any feedback.
|
Some blank line is uesd to make code more readable. It shouldn't be so decisive to remove all blank. This issue just wanna remove the black at the begining of a code block. Please at least add a knob if you have a plan to merge the feature that remove other blank lines. @bwendling |
|
Please add a new knob + appropriate tests |
This PR fixes #1091