JSON wrapper which inputs to a dictionary and outputs a JSON object

Review Request #11521 — Created March 20, 2021 and submitted — Latest diff uploaded

Information

RBTools
master

Reviewers

JSON wrapper class which inputs to a dictionary and outputs a JSON object. Class
is defined in rbtools/commands/__init__.py Command class. New command --json
added to global options, which can be added to any command. When --json is active
run_from_argv will print the json object using Python's json library.

For a full list of proposed JSON objects for each command see:
https://www.notion.so/reviewboard/a8cd6ee32806415fb7bba484d630863e?v=25fb1c9182064421ab17e55606da765b

Passed all tests in Command. Added new tests in test_main.py for initializing
wrapper, adding key value pairs to dictionary, getting correct JSON string from
dictionary, and printing to output stream with correct JSON string.

Diff Revision 10

This is not the most recent revision of the diff. The latest diff is revision 13. See what's changed.

orig
1
2
3
4
5
6
7
8
9
10
11
12
13

Commits

First Last Summary ID Author
added JSON wrapper class to main.py which inputs to a dictionary and outputs ...
9bfcd1b986f5b42603b0809c7d78b638f6cee848 Ryan Kang
added new method to print JSON to stream object and tests to ensure it works ...
fbd48ac58a17e2f8d9feb7a219f66d061eed989c Ryan Kang
added new global command --json
9cf5b3f5bb931691494dfb7922a5a0c910ea8a2d Ryan Kang
added conditional at the end of command cycle to print JSON is enabled
2876f2452d8b0655055e362ef6684de8b8e32ae7 Ryan Kang
added method to append to classes and tests to ensure items are appended corr...
bcf004f831c02cbb35dfb5dc3d61b5e3406af2b5 Ryan Kang
added new method to add errors to existing errors key or create a new one
195b6bf5193604d04511431c6761790a033fb74f Ryan Kang
Fixed issues with extra white spaces in files from Review Bot
6bb1b7d1a5798e5c1b547cc7b705b848b1a4d13d Ryan Kang
Added docstrings to JSONOutput class and changed name from JSONWrapper to JSO...
Improved command hint for --json Fixed header in test_main to import kgb and concatonated imports from rbtools.commands Created _setup() method in JSONOutputTests test class to standardize JSONOutput initialization
75af994a92e6b1ebae91f8a5da0ce5cf4aadc867 Ryan Kang
Fixed minor formatting issues in test_main.py
572bb4ce5998732a35c0380c17bf31d6cef461ac Ryan Kang
Updated JSONOutput docstrings to format with guidelines
0e811e589d36ff193279d6e6d8a01a67d9b2074b Ryan Kang
Updated docstrings in JSONOutputTests in test_main.py to comply with guidelines
b3970c176e63810f47ad5e642d947259d3d54d7a Ryan Kang
Checking if there are any errors in json to decide status
9623fa15b41db8b60b8ed18fba179b5d94bd0d31 Ryan Kang
Fixed trailing white space in test_main.test_hson_wrapper_append
dc879872ed0c58fb6c82c93663a1c3a54e32e34b Ryan Kang
Fixed blank lines with spaces in __init__ Command.run_from_argv
ae3587acb5acf8b999ab248eb52415d6864748de Ryan Kang
rbtools/commands/__init__.py
rbtools/commands/tests/test_main.py
Loading...