hardhat-gas-reporter icon indicating copy to clipboard operation
hardhat-gas-reporter copied to clipboard

Output to a readable file?

Open liron-navon opened this issue 2 years ago • 1 comments

can we make an output to MD/HTML? anything that is a bit more human readable? it is seen nicely in the console, but is not readable once it's a file, also maybe JSON/XML? to make it machine-readable more easily?

liron-navon avatar Feb 01 '22 16:02 liron-navon

Hi @liron-navon

it is seen nicely in the console, but is not readable once it's a file,

Are you seeing the table mangled with extra characters? If so you can prevent that by setting the noColors option to true.

Alternative formats is a great idea and there is some prior work in this direction:

  • an .md formatted table used to represent the data in the Github UI for people using the codechecks integration is generated at eth-gas-reporter in lib/codechecksReport.js.
  • a reStructured text formatted table (useful for ReadTheDocs) can be generated by using the rst option.

Lastly, the gas reporter writes all the data it collects to a JSON file at ./gasReporterOutput.json whenever the environment variable CI is set to true. This might be useful for experimenting with alternative table formats.

cgewecke avatar Feb 01 '22 18:02 cgewecke

Markdown was added in the latest version (2.0). If someone is interested in adding HTML am happy to accept a pull request - there's architecture in place for arbitrary output formats in the codebase now.

Closing for now.

https://github.com/cgewecke/hardhat-gas-reporter/releases/tag/v2.0.0

cgewecke avatar Mar 14 '24 05:03 cgewecke