-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutput_unifier.py
More file actions
29 lines (25 loc) · 1.13 KB
/
output_unifier.py
File metadata and controls
29 lines (25 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
""" Unifies the metrics produced by a tool on different files in a single
json file, then uses the retrieved data to compute the global metrics """
from cccc import helper_test_cccc, standardizer_cccc
from exit_codes import log_warn
from halstead import helper_test_halstead, standardizer_halstead
from mi import helper_test_mi, standardizer_mi
from rust_code_analysis import (
helper_test_rust_code_analysis,
standardizer_rust_code_analysis,
)
from tokei import helper_test_tokei, standardizer_tokei
def unifier(tool_manager, files_to_analyze, one_json_per_tool):
outputs = {}
for tool in tool_manager.get_enabled_tools():
# Standardize the output of each tool
standardized_output, files_nspace = globals()[
"standardizer_" + tool.replace("-", "_")
](tool_manager.get_tool_output(tool))
# Compute the final global metrics starting from the standardized
# output of a tool
if tool_manager.get_tool_output(tool):
outputs[tool] = globals()["helper_test_" + tool.replace("-", "_")](
standardized_output, files_nspace
)
return outputs