def main()

in quality-checks/run_all.py [0:0]


def main() -> None:
    """Start execution of the script."""
    verify_in_repo_root()

    quality_checks_dir = "./quality-checks/"
    failed_scripts: List[str] = []

    # Iterate over every file in the quality-checks directory
    for file in os.listdir(quality_checks_dir):
        filepath = os.path.join(quality_checks_dir, file)

        # Exclude README.md and run_all.sh
        if file in ["README.md", "run_all.py"]:
            continue

        # Check if the file is executable
        if os.access(filepath, os.X_OK):
            print(f"Executing: {file}")
            with subprocess.Popen(
                filepath, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
            ) as process:
                prefix_output(file, process)
                process.wait()  # Wait for the process to complete

                # Check the exit status of the script
                if process.returncode != 0:
                    print(
                        f"Script {file} failed with exit status "
                        f"{process.returncode}."
                    )
                    failed_scripts.append(file)
            print()

    # Exit with a non-zero status if any script failed
    if failed_scripts:
        print("The following scripts failed:")
        for fs in failed_scripts:
            print(f"- {fs}")
        sys.exit(1)