class BadConceptionFinder
var mclassdef: MClassDef
var array_badconception = new Array[BadConception]
var phase: CodeSmellsMetricsPhase
var model: Model
var filter: ModelFilter
var score = 0.0
# Collect code smell with selected toolcontext option
fun collect do
var bad_conception_elements = new Array[BadConception]
# Check toolcontext option
if phase.toolcontext.opt_feature_envy.value or phase.toolcontext.opt_all.value then bad_conception_elements.add(new FeatureEnvy(phase, model, filter))
if phase.toolcontext.opt_long_method.value or phase.toolcontext.opt_all.value then bad_conception_elements.add(new LongMethod(phase, model, filter))
if phase.toolcontext.opt_long_params.value or phase.toolcontext.opt_all.value then bad_conception_elements.add(new LongParameterList(phase, model, filter))
if phase.toolcontext.opt_no_abstract_implementation.value or phase.toolcontext.opt_all.value then bad_conception_elements.add(new NoAbstractImplementation(phase, model, filter))
if phase.toolcontext.opt_large_class.value or phase.toolcontext.opt_all.value then bad_conception_elements.add(new LargeClass(phase, model, filter))
# Collected all code smell if their state is true
for bad_conception_element in bad_conception_elements do
if bad_conception_element.collect(self.mclassdef,phase.toolcontext.modelbuilder) then array_badconception.add(bad_conception_element)
end
# Compute global score
collect_global_score
end
fun print_collected_data do
if array_badconception.length != 0 then
print "--------------------"
print phase.toolcontext.format_h1("Full name: {mclassdef.full_name} Location: {mclassdef.location}")
for bad_conception in array_badconception do
bad_conception.print_result
end
end
end
fun collect_global_score do
if array_badconception.not_empty then
for bad_conception in array_badconception do
self.score += bad_conception.score
end
end
end
end
src/metrics/codesmells_metrics.nit:118,1--160,3