Last active
June 28, 2023 21:01
-
-
Save lmazuel/fd6cb03b89cbcfc450d016684378c7ee to your computer and use it in GitHub Desktop.
Run next-pylint on all data-planes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import check_output, CalledProcessError, DEVNULL | |
from pathlib import Path | |
from multiprocessing import Pool | |
from ci_tools.environment_exclusions import is_check_enabled | |
BASE_FOLDER = "/home/lmazuel/git/azure-sdk-for-python/" | |
TOX_INI = BASE_FOLDER+"eng/tox/tox.ini" | |
SDK_FOLDER = BASE_FOLDER+"sdk" | |
def run_next_pylint(folder: str): | |
try: | |
check_output(["tox", "-e", "next-pylint", "--root", folder, "-c", TOX_INI], stderr=DEVNULL) | |
# Success | |
print(f"Success with {folder}") | |
return True | |
except CalledProcessError as e: | |
print(f"Error while running next-pylint: {folder}") | |
return False | |
def get_package_folders(): | |
package_folders = [] | |
for service in Path(SDK_FOLDER).iterdir(): | |
if not service.is_dir(): | |
continue | |
if service.name == "nspkg": | |
continue | |
for package in service.iterdir(): | |
if not package.is_dir() or package.name.startswith("azure-mgmt") or not package.name.startswith("azure"): | |
continue | |
if is_check_enabled(str(package.absolute()), "pylint"): | |
package_folders.append(str(package)) | |
return package_folders | |
def walk(): | |
folders = get_package_folders() | |
with Pool() as p: | |
result = p.map(run_next_pylint, folders) | |
zipped = list(zip(folders, result)) | |
success = [f for f, r in zipped if r] | |
failure = [f for f, r in zipped if not r] | |
print(f"Success: {len(success)}") | |
for s in success: | |
print(s) | |
print() | |
print(f"Failure: {len(failure)}") | |
for f in failure: | |
print(f) | |
if __name__ == "__main__": | |
walk() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment