Implement a JSON Review UI that allow user to perform actions on json files

Review Request #9515 - Created Jan. 21, 2018 and updated

Zhaolin Deng
Review Board
release-4.0.x
reviewboard, students

Json files is handled as an uneditble attachments in the current
version.
I implemented a new class JSONReviewUI that
enhence Review board's ability to process JSON file.

New features include:

  • Rendering JSON in an easy-to-read format.
  • Allowing the user to comment on the prettified file based on
    line numbers.
  • Auto-sorting of output keys.
  • Allow user to compare the changes of files in diffs

Ran unit tests.

Tested the development environment with:

  • Properly formatted JSON files.
  • JSON files with long lines.
  • Minified JSON files.
  • Highly-nested JSON files.
Loading file attachments...

  • 0
  • 0
  • 5
  • 0
  • 5
Description From Last Updated
Zhaolin Deng
Zhaolin Deng
Barret Rennie
  1. 
      
    1. What will be the best way to check the line has less than 72 characters?

  2. Can you wrap your description at 72 characters and format it as markdown?

    We can do stuff like:

    New features include:
    
     - Rendering JSON in an easy-to-read format.
     - Allowing the user to comment on the prettified file based on line numbers.
     - Auto-sorting of output keys.
    

    etc.

    Which will render as a list.

  3. As for your testing done, how about:

    Ran unit tests.
    Tested the development environment with:
    
     - Properly formatted JSON files.
     - JSON files with long lines.
     - Minified JSON files.
     - Highly-nested JSON files.
    

    The coverage percentage is not required.

  4. This needs some unit tests ensuring that (at a minimum):

    • the JSON UI is used for JSON files
    • prettified JSON files are ordered consistently between viewings
    • output is actually prettified
    1. I could not come up with a good idea to test the prettified JSON , so I uploaded an ugly unsorted JSON and a sorted,prettified JSON and check their equallity after the render;

      I test tthe JSON UI in attachment files instead of ui files.

      The Markdown does not have basic unit test.

      For the Json document that has incorrect format, Reviewboard will currently render "Error while rendering Markdown content:"
      I am not sure if theis is the correct behavior.

  5. reviewboard/reviews/ui/jsonui.py (Diff revision 1)
     
     

    How about JSONReviewUI ? It's a little shorter and gets the same point across.

  6. reviewboard/reviews/ui/jsonui.py (Diff revision 1)
     
     

    All methods should have docstring documenting what they do. Check out this guide for our docstring requirements.

  7. 
      
Zhaolin Deng
Zhaolin Deng
Zhaolin Deng
Review request changed

Description:

   

Json files is handled as an uneditble attachments in the current

    version.
~   I implemented a new class TextBasedJSONReviewUI that
  ~ I implemented a new class JSONReviewUI that
    enhence Review board's ability to process JSON file.

   
   

   
   

New features include:

   
   
  • Rendering JSON in an easy-to-read format.
   
  • Allowing the user to comment on the prettified file based on
    line numbers.
   
  • Auto-sorting of output keys.
   
  • Allow user to compare the changes of files in diffs
Loading...