Browse Source

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
changes/19/142219/2 0.21.1
Roger Luethi 7 years ago
parent
commit
e77e51365b
  1. 5
      RELEASE_NOTES.rst
  2. 2
      os_doc_tools/jsoncheck.py

5
RELEASE_NOTES.rst

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

2
os_doc_tools/jsoncheck.py

@ -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):

Loading…
Cancel
Save