pep8analysis: enable analyzing from stream
[nit.git] / src / simple_misc_analysis.nit
index bc6c945..35fa66c 100644 (file)
 #  * superfluous parentheses
 #  * nested "once" expressions
 #  * use of "while true" instead of "loop"
-package simple_misc_analysis
+module simple_misc_analysis
 
 import toolcontext
 import parser
+import phase
+
+redef class ToolContext
+       var simple_misc_analysis_phase: Phase = new SimpleMiscAnalysisPhase(self, null)
+end
+
+private class SimpleMiscAnalysisPhase
+       super Phase
+       redef fun process_nmodule(nmodule) do nmodule.do_simple_misc_analysis(toolcontext)
+end
 
 redef class AModule
        # Visit the module to detect easy warnings that does not need the metamodel or the importation
@@ -38,7 +48,7 @@ private class SimpleMiscVisitor
        super Visitor
        redef fun visit(n)
        do
-               if n != null then n.accept_simple_misc(self)
+               n.accept_simple_misc(self)
        end
 
        # Number of nested once