def parse_yaml_config(yaml_config, repo_home, cache_enabled): """Converts a dictionary (parsed Yaml) to the internal representation.""" config = collections.defaultdict(list) for name, data in yaml_config.items(): command = utils.replace_variables([data['command']], repo_home)[0] requirements = utils.replace_variables(data.get('requirements', []), repo_home) arguments = utils.replace_variables(data.get('arguments', []), repo_home, data.get('config')) not_found_programs = utils.programs_not_in_path([command] + requirements) if not_found_programs: linter_command = utils.Partial(missing_requirements_command, not_found_programs, data['installation']) else: linter_command = utils.Partial(lint_command, name, command, arguments, data['filter'], cache_enabled) for extension in data['extensions']: config[extension].append(linter_command) return config
def parse_yaml_config(yaml_config, repo_home): """Converts a dictionary (parsed Yaml) to the internal representation.""" config = collections.defaultdict(list) variables = { 'DEFAULT_CONFIGS': os.path.join(os.path.dirname(__file__), 'configs'), 'REPO_HOME': repo_home, } for name, data in yaml_config.items(): command = _replace_variables([data['command']], variables)[0] requirements = _replace_variables( data.get('requirements', []), variables) arguments = _replace_variables(data.get('arguments', []), variables) not_found_programs = utils.programs_not_in_path([command] + requirements) if not_found_programs: linter_command = Partial(missing_requirements_command, not_found_programs, data['installation']) else: linter_command = Partial(lint_command, name, command, arguments, data.get('fatal_exits', []), data['filter']) for extension in data['extensions']: config[extension].append(linter_command) return config
def parse_yaml_config(yaml_config, repo_home): """Converts a dictionary (parsed Yaml) to the internal representation.""" config = collections.defaultdict(list) variables = { 'DEFAULT_CONFIGS': os.path.join(os.path.dirname(__file__), 'configs'), 'REPO_HOME': repo_home, } for name, data in yaml_config.items(): command = _replace_variables([data['command']], variables)[0] requirements = _replace_variables(data.get('requirements', []), variables) arguments = _replace_variables(data.get('arguments', []), variables) not_found_programs = utils.programs_not_in_path( [command] + requirements) if not_found_programs: linter_command = Partial(missing_requirements_command, name, not_found_programs, data['installation']) else: linter_command = Partial(lint_command, name, command, arguments, data['filter']) for extension in data['extensions']: config[extension].append(linter_command) return config