]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Don't put four empty lines between top-level functions split by a comment
authorŁukasz Langa <lukasz@langa.pl>
Sat, 17 Mar 2018 05:14:43 +0000 (22:14 -0700)
committerŁukasz Langa <lukasz@langa.pl>
Sat, 17 Mar 2018 05:14:43 +0000 (22:14 -0700)
README.md
black.py

index 61498b2abfa1aca5c099a15d1b872ed75dddf94b..0ccef300630c34294b3d7d198dd361ca80a320a8 100644 (file)
--- 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)
index 10346a9143c4e490d7fb6a8f314cc00a94e9664a..0fe8fef255be119d3569071404544b153d5ce89f 100644 (file)
--- 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