Add final newline to file formatting

The JSON formatting created by jsoncheck.py omits the file's final
newline. It claims that files with such a newline need reformatting
and removes the final newline in a file when reformatting.

This patch brings jsoncheck.py in line with the rest of the tools
which prefer text files to end with a newline.

Update release notes for pushing out the bug fix.

Closes-Bug: #1403159
Change-Id: I35eab544b183c05b167ce9917d92f0f1f919b745
This commit is contained in:
Roger Luethi 2014-12-16 21:39:10 +01:00
parent 987748f89d
commit e77e51365b
2 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,11 @@
Release notes
=============
0.21.1
------
* ``jsoncheck``: have formatted JSON files end with a newline (lp:bug 1403159)
0.21
----

View File

@ -107,7 +107,7 @@ def _parse_json(raw):
def _format_parsed_json(parsed):
"""Pretty-print JSON file content while retaining key order."""
return json.dumps(parsed, sort_keys=False, separators=(',', ': '),
indent=4)
indent=4) + "\n"
def _process_file(path, formatting=None, verbose=False):