Exemplo n.º 1
0
 def lint(self):
     errors=0
     from postomaat.funkyconsole import FunkyConsole
     fc=FunkyConsole()
     self._lint_dependencies(fc)
     print(fc.strcolor('Loading plugins...','magenta'))
     if not self.load_plugins():
         print(fc.strcolor('At least one plugin failed to load','red'))
     print(fc.strcolor('Plugin loading complete','magenta'))
     
     print("Linting %s" % fc.strcolor("main configuration",'cyan'))
     if not self.checkConfig():
         print(fc.strcolor("ERROR","red"))
     else:
         print(fc.strcolor("OK","green"))
     
     allplugins=self.plugins
     
     for plugin in allplugins:
         print("")
         print("Linting Plugin %s Config section: %s" %
               (fc.strcolor(str(plugin),'cyan'), fc.strcolor(str(plugin.section),'cyan')))
         try:
             result=plugin.lint()
         except Exception as e:
             print("ERROR: %s"%e)
             result=False
         
         if result:
             print(fc.strcolor("OK","green"))
         else:
             errors=errors+1
             print(fc.strcolor("ERROR","red"))
     print("%s plugins reported errors."%errors)