-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Black incorrectly preserves trailing comma on one-line collection literals and function declarations #1202
Comments
This is a bug unfortunately. There are two acceptable behaviors for black:
|
As mentioned in #1010, this triggers the |
Should be removed by Black, but currently buggy. See: psf/black#1202
Should be removed by Black, but currently buggy. See: psf/black#1202
* Format Python code with Black * Update .flake8 for Black * Address most flake8 issues * Fix flake8 E231: missing whitespace after ',' Should be removed by Black, but currently buggy. See: psf/black#1202 * Re-run Black * One final black/flake8 fix * Fail CI if Black does not pass
This PR proposes to add [Black](https://github.com/psf/black) into Koalas. - `dev/linter-python` detects if codes are formatted or not by Black - `dev/reformat` script that reformats the codes by using black. - It still keeps 100 line length style, and ignores `E231` and `E203` at pycodestyle. See also psf/black#429 and psf/black#1202. Black automatically formats and violates several rules. - Update contribution guide. Resolve #755 Co-authored-by: Deepyaman Datta <[email protected]>
#1288 will address this issue, it's going to get fixed as part of the next (stable) release |
This PR proposes to add [Black](https://github.com/psf/black) into Koalas. - `dev/linter-python` detects if codes are formatted or not by Black - `dev/reformat` script that reformats the codes by using black. - It still keeps 100 line length style, and ignores `E231` and `E203` at pycodestyle. See also psf/black#429 and psf/black#1202. Black automatically formats and violates several rules. - Update contribution guide. Resolve #755 Co-authored-by: Deepyaman Datta <[email protected]>
You can still get it if you run |
That's not true with latest black. Please open a new issue with a repro if you still see something like this with latest black. |
The trailing comma is unnecessarily preserved when collapsing an inline dict that is a function argument, though not when the dict is in an assignment. Furthermore, a dict with a trailing comma isn't being collapsed when it could fit onto a single line (I'm not familiar enough to know if this part is a real bug, but it seemed weird). See MWE below.
I couldn't find this anywhere else, apologies if this is a duplicate. Possibly related #925 -- at least, the behavior seemed OK then, anyway.
The text was updated successfully, but these errors were encountered: