Skip to content
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

Automatically add newline at the end of file #1874

Closed
jaladh-singhal opened this issue Dec 18, 2020 · 4 comments
Closed

Automatically add newline at the end of file #1874

jaladh-singhal opened this issue Dec 18, 2020 · 4 comments
Labels
S: needs repro Needs a functional reproduction T: bug Something isn't working

Comments

@jaladh-singhal
Copy link

jaladh-singhal commented Dec 18, 2020

Is your feature request related to a problem? Please describe.
Black doesn't enter newline at EOF on its own if there is not any

Describe the solution you'd like
It should auto insert new line or at least provide a configuration option that does so

Additional context
I think it's recommended somewhere in PEP8, besides several other code formatters does it

@jaladh-singhal jaladh-singhal added the T: enhancement New feature or request label Dec 18, 2020
@JelleZijlstra
Copy link
Collaborator

I believe we already do this. Could you give an example where we don't?

@ichard26
Copy link
Collaborator

Maybe VS Code integration -> #1662?

@ichard26 ichard26 added T: bug Something isn't working and removed T: enhancement New feature or request labels Dec 22, 2020
@rcalfredson
Copy link

I stumbled across a corner case where the newline doesn't appear: seemingly, when the length of the last line equals the limit (i.e., the default of 88). Here is a tiny script where I found it:

import numpy as np

PATCH_UBOUND = 160
patch = np.zeros((PATCH_UBOUND, PATCH_UBOUND, 1))
for _ in range(4):
    patch[np.random.randint(0, PATCH_UBOUND), np.random.randint(0, PATCH_UBOUND), :] = 1

In all other cases, the newline got added in my experience with Black.

@ichard26 ichard26 added the S: needs repro Needs a functional reproduction label May 29, 2021
@ichard26
Copy link
Collaborator

We haven't been able to find a consistent working reproduction so closing (even the one above doesn't work for me).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: needs repro Needs a functional reproduction T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants