metrics: extract mclasses_metrics in its own nit module
[nit.git] / src / metrics / inheritance_metrics.nit
index 0cfef0b..015dbe1 100644 (file)
@@ -19,6 +19,22 @@ module inheritance_metrics
 
 import model
 private import metrics_base
+import phase
+import frontend
+
+redef class ToolContext
+       var inheritance_metrics_phase = new InheritanceMetricsPhase(self, null)
+end
+
+# Extract metrics about module and class hierarchies.
+private class InheritanceMetricsPhase
+       super Phase
+       redef fun process_mainmodule(mainmodule)
+       do
+               if not toolcontext.opt_inheritance.value and not toolcontext.opt_all.value then return
+               compute_inheritance_metrics(toolcontext, toolcontext.modelbuilder.model)
+       end
+end
 
 redef class Model
        # Extract the subset of classes from a set of mclass