tintinweb / solgrep

🧠 A scriptable semantic grep utility for solidity
https://www.npmjs.com/package/solgrep
142 stars 17 forks source link

Output groups #5

Closed mrx23dot closed 2 years ago

mrx23dot commented 2 years ago

When doing multiple filters at the same time, can we have groups in the output? Otherwise the output is just a continuous blob, impossible to distinguish which output belongs to which filter. Calling the tool multiple times is less efficient.

for solgrep --find="function.visibility.includes('external')" --find="function.name" --rule=Stats

suggested output:

{[ 
  {rule="find="function.visibility.includes('external')"",   [results] },
  {rule="find="function.name",   [results] },
  {rule="Stats",   [results] },
]}
tintinweb commented 2 years ago

Hey @mrx23dot,

we optimize to store findings grouped by source file and findings are listed as they are detected in code. This is highly opinionated but currently there is not intention to change. I suggest to use the --output option and post-process the raw JSON findings with your own script to extract/group results the way you like them 🙌