From: Ɓukasz Langa Date: Sat, 17 Mar 2018 05:14:43 +0000 (-0700) Subject: Don't put four empty lines between top-level functions split by a comment X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/b9c06a0d23b7d422d1c8dc1727d6fe15757a4716?hp=7ad9445caf53f236dde8f654aa61308f18aa4313 Don't put four empty lines between top-level functions split by a comment --- diff --git a/README.md b/README.md index 61498b2..0ccef30 100644 --- a/README.md +++ b/README.md @@ -269,6 +269,9 @@ More details can be found in [CONTRIBUTING](CONTRIBUTING.md). * remove a trailing comma if there is a single argument to a call +* if top level functions were separated by a comment, don't put four + empty lines after the upper function + * fixed missing space in numpy-style array indexing (#33) * fixed spurious space after star-based unary expressions (#31) diff --git a/black.py b/black.py index 10346a9..0fe8fef 100644 --- a/black.py +++ b/black.py @@ -628,6 +628,10 @@ class EmptyLineTracker: (two on module-level), as well as providing an extra empty line after flow control keywords to make them more prominent. """ + if current_line.is_comment: + # Don't count standalone comments towards previous empty lines. + return 0, 0 + before, after = self._maybe_empty_lines(current_line) self.previous_after = after self.previous_line = current_line