def test_create(self): config = Config.from_dict({'checkers': { 'WhiteSpaceChecker': '' }}) checkers = create_checkers(config)
level = [logging.ERROR, logging.INFO, logging.DEBUG] if args.logfile == '-': logging.basicConfig(format=LOG_CONSOLE_FORMAT, level=level[args.verbose]) else: logging.basicConfig(filename=args.logfile, level=level[args.verbose]) config = Config(checkers={'WhiteSpaceChecker': '', 'CodeValidatorChecker': ''}).add_from_default_locations() config.add_from_args(args) if args.config: config.add_from_json(args.config) return config tempdir = None try: config = get_config() checkers = create_checkers(config) logging.debug('Using %s', ', '.join([c.get_name() for c in checkers])) errors = None if checkers: tempdir = tempfile.mkdtemp() changes = retrieve_changed_files(tempdir, GitRepo(), config.base, config.commit) logging.debug('%d changes: %s', len(changes), [str(c) for c in changes]) errors = check(checkers) if errors: error_msg = '\n' for checker, checker_errors in errors.iteritems(): error_msg += '%s %s\n' % (checker.get_name(), checker.get_documentation_url()) for error in checker_errors: error_msg += ' %s\n' % error