rust-code-analysis
rust-code-analysis copied to clipboard
Aggregate metrics according to their language
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:
mergeis called by each thread at the end of its execution and adds the result of each thread to a global vector calledVecfinalizeinstead is called when each thread has finished to be run and dumps the content ofVecin the required format
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
It would be helpful to dump the aggregate metrics through the Tokei tabular output