From e77e51365b563fefd7a0eb6a15b6bcf79160e755 Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Tue, 16 Dec 2014 21:39:10 +0100 Subject: [PATCH] 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 --- RELEASE_NOTES.rst | 5 +++++ os_doc_tools/jsoncheck.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index 1260384e..f69395fd 100644 --- a/RELEASE_NOTES.rst +++ b/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 ---- diff --git a/os_doc_tools/jsoncheck.py b/os_doc_tools/jsoncheck.py index de78610a..755052c1 100644 --- a/os_doc_tools/jsoncheck.py +++ b/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):