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

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:

Fix incorrect space before colon in if/while stmts (#1655)
authorRichard Si <63936253+ichard26@users.noreply.github.com>
Mon, 31 Aug 2020 21:20:05 +0000 (17:20 -0400)
committerGitHub <noreply@github.com>
Mon, 31 Aug 2020 21:20:05 +0000 (14:20 -0700)
commit1d2d7264ec7c448744b771910cc972da03b1cb80
tree7b9184ac2bf7e71cf3fc5cd5e2b949f446f55b49
parent573b8de54470dbad8bcaaebd5a28dad507c44666
Fix incorrect space before colon in if/while stmts (#1655)

* Fix incorrect space before colon in if/while stmts

Previously Black would format this code

```
if (foo := True):
print(foo)
```

as

```
if (foo := True) :
print(foo)
```

adding an incorrect space after the RPAR. Buggy code in the
normalize_invisible_parens function caused the colon to be wrapped in
invisible parentheses. The LPAR of that pair was then prefixed with a
single space at the request of the whitespace function.

This commit fixes the accidental skipping of a pre-condition check
which must return True before parenthesis normalization of a specific
child Leaf or Node can happen. The pre-condition check being skipped
was why the colon was wrapped in invisible parentheses.

* Add an entry in CHANGES.md
CHANGES.md
docs/change_log.md
src/black/__init__.py
tests/data/pep_572.py