nitc :: BadConception :: collect
# Collection method
fun collect(mclassdef: MClassDef, model_builder: ModelBuilder): Bool is abstract
src/metrics/codesmells_metrics.nit:177,2--178,81
redef fun collect(mclassdef, model_builder): Bool do
self.number_attribut = mclassdef.collect_intro_and_redef_mattributes(filter).length
# Get the number of methods (Accessor include) (subtract the get and set of attibutes with (numberAtribut*2))
self.number_method = mclassdef.collect_intro_and_redef_methods(filter).length
self.score_rate
return self.number_method.to_f > phase.average_number_of_method and self.number_attribut.to_f > phase.average_number_of_attribute
end
src/metrics/codesmells_metrics.nit:199,2--205,4
redef fun collect(mclassdef, model_builder): Bool do
for meth in mclassdef.collect_intro_and_redef_mpropdefs(filter) do
var threshold_value = 4
# Get the threshold value from the toolcontext command
if phase.toolcontext.opt_long_params_threshold.value != 0 then threshold_value = phase.toolcontext.opt_long_params_threshold.value
# Check if the property is a method definition
if not meth isa MMethodDef then continue
# Check if method has a signature
if meth.msignature == null then continue
if meth.msignature.mparameters.length <= threshold_value then continue
self.bad_methods.add(meth)
end
self.score_rate
return self.bad_methods.not_empty
end
src/metrics/codesmells_metrics.nit:224,2--238,4
redef fun collect(mclassdef, model_builder): Bool do
var mmethoddefs = call_analyze_methods(mclassdef,model_builder, filter)
for mmethoddef in mmethoddefs do
var max_class_call = mmethoddef.class_call.max
# Check if the class with the maximum call is >= auto-call and the maximum call class is != of this class
if mmethoddef.class_call[max_class_call] <= mmethoddef.total_self_call or max_class_call.mclass.full_name == mclassdef.mclass.full_name then continue
self.bad_methods.add(mmethoddef)
end
self.score_rate
return self.bad_methods.not_empty
end
src/metrics/codesmells_metrics.nit:265,2--275,4
redef fun collect(mclassdef, model_builder): Bool do
var mmethoddefs = call_analyze_methods(mclassdef,model_builder, filter)
var threshold_value = phase.average_number_of_lines.to_i
# Get the threshold value from the toolcontext command
if phase.toolcontext.opt_long_method_threshold.value != 0 then threshold_value = phase.toolcontext.opt_long_method_threshold.value
for mmethoddef in mmethoddefs do
if mmethoddef.line_number <= threshold_value then continue
self.bad_methods.add(mmethoddef)
end
self.score_rate
return self.bad_methods.not_empty
end
src/metrics/codesmells_metrics.nit:310,2--322,4
redef fun collect(mclassdef, model_builder): Bool do
if not mclassdef.mclass.is_abstract and not mclassdef.mclass.is_interface then
if mclassdef.collect_abstract_methods(filter).not_empty then
bad_methods.add_all(mclassdef.collect_not_define_properties(filter))
end
end
self.score_rate
return bad_methods.not_empty
end
src/metrics/codesmells_metrics.nit:349,2--357,4