Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support --pretty-json and --json-indent for all CLI options #12011

Closed
cameel opened this issue Sep 22, 2021 · 3 comments
Closed

Support --pretty-json and --json-indent for all CLI options #12011

cameel opened this issue Sep 22, 2021 · 3 comments
Labels
closed due inactivity The issue/PR was automatically closed due to inactivity. easy difficulty good first issue candidate Could be a "good first issue" but something is blocking it or it has open questions. stale The issue/PR was marked as stale because it has been open for too long.

Comments

@cameel
Copy link
Member

cameel commented Sep 22, 2021

In #11583 we made --pretty-print affect Standard JSON and also added the --json-indent option. There are still some command-line options that ignore these:

  • --asm-json
  • --ast-compact-json
  • --abi
  • --userdoc
  • --devdoc
  • --storage-layout
  • --metadata

Some of them always pretty-print the JSON but with hard-coded indent size, some do not pretty-print at all. Change them all so that by default the JSON output is compact and changes when --pretty-print/json-indent is used.

We might want to exempt --metadata from this since we embed its hash in the bytecode and a pretty-printed version would not match it. But maybe that's ok - it's meant to be reproducible and being able to easily inspect it is also important. And in any case --combined-json metadata does get affected by --pretty-print so we already have this problem.

After changing it, we'll need to add pretty printing options to command-line tests to keep them readable. Alternatively, we could implement #7665 first.

Backwards Compatibility

I don't think that we guarantee stable JSON formatting between versions so I'd say this is not breaking.

Changing the formatting for --metadata might affect tools that hash its output but also use --pretty-json to get nice output from --combined-json at the same time. I think it's a pretty obscure case though.

@akali
Copy link
Contributor

akali commented Oct 22, 2021

Creater PR for this issue, skipped metadata as it prints json in a bit different way

@NunoFilipeSantos NunoFilipeSantos added the good first issue candidate Could be a "good first issue" but something is blocking it or it has open questions. label Dec 5, 2022
@github-actions
Copy link

This issue has been marked as stale due to inactivity for the last 90 days.
It will be automatically closed in 7 days.

@github-actions github-actions bot added the stale The issue/PR was marked as stale because it has been open for too long. label Mar 21, 2023
@github-actions
Copy link

Hi everyone! This issue has been automatically closed due to inactivity.
If you think this issue is still relevant in the latest Solidity version and you have something to contribute, feel free to reopen.
However, unless the issue is a concrete proposal that can be implemented, we recommend starting a language discussion on the forum instead.

@github-actions github-actions bot added the closed due inactivity The issue/PR was automatically closed due to inactivity. label Mar 29, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed due inactivity The issue/PR was automatically closed due to inactivity. easy difficulty good first issue candidate Could be a "good first issue" but something is blocking it or it has open questions. stale The issue/PR was marked as stale because it has been open for too long.
Projects
None yet
Development

No branches or pull requests

4 participants