Skip to content

[TM-100] Prettify printer output

Sandeep.C.R requested to merge sras/tm100-prettify-printer-output into master

Description

Problem: Current pretty printer prints everything in a single line.

Solution: In the Michelson.Printer.Util module, replace call to renderOneLine with renderPretty which enables multi-line, indented output. The remaining alignment issues are fixed by the following steps. In the renderOpsList function, force horizontal alignment of operations by using the align function when the operations are concatenated vertically. Then disable, forced single line output in calls to renderOpsList by un-setting the boolean argument.

Tests: Sample contracts have been added to contracts/pretty folder, that contain contracts with their prettified counterparts as separate files. The tests just compare the output of the pretty printer with the expected content from the prettified files.

Related issue(s)

https://issues.serokell.io/issue/TM-100

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • [ ] If I added new functionality, I added tests covering it.
    • [ ] If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:

Stylistic guide (mandatory)

Edited by Ivan Gromakovskii

Merge request reports