Opened 6 weeks ago

Closed 13 days ago

Last modified 13 days ago

#36177 closed Cleanup/optimization (fixed)

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

Reported by: Tom Carrick Owned by: Tom Carrick
Component: Core (Management commands) Version: dev
Severity: Normal Keywords:
Cc: Tom Carrick, Trey Hunner Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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.

Change History (9)

comment:1 by Sarah Boyce, 6 weeks 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

comment:2 by Tom Carrick, 3 weeks ago

Owner: set to Tom Carrick
Status: newassigned

comment:3 by Tom Carrick, 3 weeks ago

Has patch: set

comment:4 by Sarah Boyce, 2 weeks ago

Patch needs improvement: set

comment:5 by Tom Carrick, 2 weeks ago

Patch needs improvement: unset

comment:6 by Sarah Boyce, 2 weeks ago

Triage Stage: AcceptedReady for checkin

comment:7 by GitHub <noreply@…>, 13 days ago

Resolution: fixed
Status: assignedclosed

In 8df5ce8:

Fixed #36177 -- Added a trailing newline to JSON serializer. (#19232)

comment:8 by Sarah Boyce, 13 days ago

Same with this commit. Selected rebase and merge but it appears to have "squashed merged" and updated the commit message. Apologies

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