rust-code-analysis icon indicating copy to clipboard operation
rust-code-analysis copied to clipboard

Aggregate metrics according to their language

Open Luni-4 opened this issue 5 years ago • 2 comments

It would be helpful to aggregate metrics produced by rust-code-analysis on different files in a single global file. The aggregation should be done according to the languages contained in a determined directory. To do so, a possible approach with threads could be the following one:

Each thread computes the metrics for a single file and then sends the result to a handler which implements a specific trait called HandlerTrait.

HandlerTrait contains two functions:

  • merge is called by each thread at the end of its execution and adds the result of each thread to a global vector called Vec
  • finalize instead is called when each thread has finished to be run and dumps the content of Vec in the required format

Luni-4 avatar Apr 28 '20 15:04 Luni-4

The trait could be more general:

  • just add a result and do whatever you want with it: merge with prev results, dump it, write it in a file, ...
  • and finalize: which could do nothing or produce a final report Probably Handler isn't a good name

calixteman avatar Apr 28 '20 15:04 calixteman

It would be helpful to dump the aggregate metrics through the Tokei tabular output

Luni-4 avatar Jul 01 '20 14:07 Luni-4