Opened 5 days ago

Last modified 4 days ago

#36177 new Cleanup/optimization

Add a newline to the end of file when generating JSON fixtures

Reported by: Tom Carrick Owned by:
Component: Core (Management commands) Version: dev
Severity: Normal Keywords:
Cc: Tom Carrick, Trey Hunner Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no
Pull Requests:How to create a pull request

Description

Mostly I'd like to get rid of https://github.com/django/django/blob/0bac41fc7e4a842e8d20319cba31cc645501c245/.editorconfig#L24

It's a little annoying to work with in preparation for adding a CSS / JS formatter. While it won't run on JSON (yet?) it does complain about this line at the moment, and it feels a little awkward to have it in the first place.

It could also be useful if people like to concatenate fixtures to avoid getting the last } of one fixture on the same line as { of the next, and to avoid potential terminal issues around printing stuff without trailing newlines.

Another possibility is to actually format JSON files, which might be nice, and just add these newlines after the fact. If that seems like the better option, it's also fine.

According to the ticket's flags, the next step(s) to move this issue forward are:

  • To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is: [https://github.com/django/django/pull/#### PR].

Change History (1)

comment:1 by Sarah Boyce, 4 days ago

Cc: Trey Hunner added
Triage Stage: UnreviewedAccepted

This appears to have been added in #22463, in the ticket description it appears to want new lines at the end of files. I can't find much specific discussion around JSON files
There seems to be a little discussion around not wanting a new line in #13182

Interestingly, when adding the .editorconfig to djangoproject.com this didn't have insert_final_newline = ignore

I will tentatively accept

Note: See TracTickets for help on using tickets.
Back to Top