[Django] #36177: Add a newline to the end of file when generating JSON fixtures

23 views
Skip to first unread message

Django

unread,
Feb 9, 2025, 6:34:57 AM2/9/25
to django-...@googlegroups.com
#36177: Add a newline to the end of file when generating JSON fixtures
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Type:
| Cleanup/optimization
Status: new | Component: Core
| (Management commands)
Version: dev | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/36177>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 10, 2025, 6:22:36 AM2/10/25
to django-...@googlegroups.com
#36177: Add a newline to the end of file when generating JSON fixtures
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* cc: Trey Hunner (added)
* stage: Unreviewed => Accepted

Comment:

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
[https://github.com/django/djangoproject.com/commit/a8fec8a10622bae95146a729b4c7eab0c19d9821
adding the .editorconfig to djangoproject.com] this didn't have
`insert_final_newline = ignore`

I will tentatively accept
--
Ticket URL: <https://code.djangoproject.com/ticket/36177#comment:1>

Django

unread,
Mar 6, 2025, 4:52:21 AM3/6/25
to django-...@googlegroups.com
#36177: Add a newline to the end of file when generating JSON fixtures
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tom Carrick):

* owner: (none) => Tom Carrick
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36177#comment:2>

Django

unread,
Mar 6, 2025, 5:31:09 AM3/6/25
to django-...@googlegroups.com
#36177: Add a newline to the end of file when generating JSON fixtures
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tom Carrick):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36177#comment:3>

Django

unread,
Mar 7, 2025, 10:33:17 AM3/7/25
to django-...@googlegroups.com
#36177: Add a newline to the end of file when generating JSON fixtures
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36177#comment:4>

Django

unread,
Mar 10, 2025, 6:25:21 AM3/10/25
to django-...@googlegroups.com
#36177: Add a newline to the end of file when generating JSON fixtures
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tom Carrick):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36177#comment:5>

Django

unread,
Mar 10, 2025, 8:27:33 AM3/10/25
to django-...@googlegroups.com
#36177: Add a newline to the end of file when generating JSON fixtures
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: assigned
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36177#comment:6>

Django

unread,
Mar 11, 2025, 3:01:22 AM3/11/25
to django-...@googlegroups.com
#36177: Add a newline to the end of file when generating JSON fixtures
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: closed
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"8df5ce80d26824ce72af41edc03275d435de9432" 8df5ce8]:
{{{#!CommitTicketReference repository=""
revision="8df5ce80d26824ce72af41edc03275d435de9432"
Fixed #36177 -- Added a trailing newline to JSON serializer. (#19232)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36177#comment:7>

Django

unread,
Mar 11, 2025, 3:11:35 AM3/11/25
to django-...@googlegroups.com
#36177: Add a newline to the end of file when generating JSON fixtures
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: closed
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce):

Same with this commit. Selected rebase and merge but it appears to have
"squashed merged" and updated the commit message. Apologies
--
Ticket URL: <https://code.djangoproject.com/ticket/36177#comment:8>

Django

unread,
Mar 11, 2025, 7:45:59 AM3/11/25
to django-...@googlegroups.com
#36177: Add a newline to the end of file when generating JSON fixtures
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Tom
Type: | Carrick
Cleanup/optimization | Status: closed
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce):

It is a bug in GitHub:
https://github.com/orgs/community/discussions/153620
--
Ticket URL: <https://code.djangoproject.com/ticket/36177#comment:9>
Reply all
Reply to author
Forward
0 new messages