def _run_checks(self, spec, srpm, outfile=None): ''' Register and run all checks. ''' def apply_color(s, formatter): ''' Return s formatted by formatter or plain s. ''' return formatter(s) if Settings.use_colors else s self.checks = Checks(spec, srpm) if outfile: self.outfile = outfile elif Settings.no_report: self.outfile = '/dev/null' else: self.outfile = ReviewDirs.report_path() with open(self.outfile, "w") as output: self.log.info('Running checks and generating report') self.checks.run_checks(output=output, writedown=not Settings.no_report) if not Settings.no_report: print apply_color("Review template in: " + self.outfile, ansi.green) print apply_color(_EXIT_MESSAGE, ansi.red)