def run_pylint()

in azdev/operations/style.py [0:0]


def run_pylint(modules, checkers=None, env=None, disable_all=False, enable=None):
    def get_core_module_paths(modules):
        core_paths = []
        for p in modules["core"].values():
            _, tail = os.path.split(p)
            for x in str(tail).split("-"):
                p = os.path.join(p, x)
            core_paths.append(p)
        return core_paths

    cli_paths = get_core_module_paths(modules) + list(modules["mod"].values())

    ext_paths = []
    for path in list(modules["ext"].values()):
        glob_pattern = os.path.normcase(os.path.join("{}*".format(EXTENSION_PREFIX)))
        ext_paths.append(glob(os.path.join(path, glob_pattern))[0])

    def run(paths, rcfile, desc, checkers=None, env=None, disable_all=False, enable=None):
        if not paths:
            return None
        logger.debug("Using rcfile file: %s", rcfile)
        logger.debug("Running on %s: %s", desc, "\n".join(paths))
        command = "pylint {} --rcfile={} --jobs {}".format(
            " ".join(paths), rcfile, multiprocessing.cpu_count()
        )
        if checkers is not None:
            command += ' --load-plugins {}'.format(",".join(checkers))
        if disable_all:
            command += ' --disable=all'
        if enable is not None:
            command += ' --enable {}'.format(",".join(enable))

        return py_cmd(command, message="Running pylint on {}...".format(desc), env=env)

    cli_pylintrc, ext_pylintrc = _config_file_path("pylint")

    cli_result = run(cli_paths, cli_pylintrc, "modules",
                     checkers=checkers, env=env, disable_all=disable_all, enable=enable)
    ext_result = run(ext_paths, ext_pylintrc, "extensions",
                     checkers=checkers, env=env, disable_all=disable_all, enable=enable)
    return _combine_command_result(cli_result, ext_result)