class CodeSmellsMetricsPhase
super Phase
var average_number_of_lines = 0.0
var average_number_of_parameter = 0.0
var average_number_of_method = 0.0
var average_number_of_attribute = 0.0
redef fun process_mainmodule(mainmodule, given_mmodules) do
print toolcontext.format_h1("--- Code Smells Metrics ---")
var model = toolcontext.modelbuilder.model
var filter = new ModelFilter(private_visibility)
self.set_all_average_metrics(model)
var mclass_codesmell = new BadConceptonController(model, filter)
var collect = new Counter[MClassDef]
var mclassdefs = new Array[MClassDef]
for mclass in mainmodule.flatten_mclass_hierarchy do
mclass_codesmell.collect(mclass.mclassdefs,self)
end
if toolcontext.opt_get_all.value then
mclass_codesmell.print_all
else
mclass_codesmell.print_top(10)
end
end
fun set_all_average_metrics(model: Model) do
var model_builder = toolcontext.modelbuilder
self.average_number_of_lines = model.get_avg_linenumber(model_builder)
self.average_number_of_parameter = model.get_avg_parameter
self.average_number_of_method = model.get_avg_method
self.average_number_of_attribute = model.get_avg_attribut
end
end
src/metrics/codesmells_metrics.nit:27,1--61,3