예제 #1
0
def check():
    if get_category() != "integration":
        print("Only integrations are checked.")
        return

    manifest = get_manifest()
    issues = []

    if manifest.get("domain") is None:
        issues.append("No domain")

    if manifest.get("documentation") is None:
        issues.append("No documentation")

    if manifest.get("issue_tracker") is None:
        issues.append("No issue_tracker")

    if manifest.get("codeowners") is None:
        issues.append("No codeowners")

    if manifest.get("homeassistant"):
        issues.append("homeassistant is not valid here")

    if issues:
        for issue in issues:
            print(issue)
        exit(1)
예제 #2
0
async def check():
    if get_category() != "integration":
        print("Only integrations are checked.")
        return

    manifest = get_manifest()

    domain = manifest.get("domain")
    if domain is None:
        print("No domain")
        exit(1)

    async with GitHub(TOKEN) as github:
        repository = await github.get_repo("home-assistant/brands")
        files = await repository.get_contents("custom_integrations")
        if domain not in [x.attributes["name"] for x in files]:
            print(
                f"{domain} is not added to https://github.com/home-assistant/brands"
            )
            print(
                "This is needed to ensure the best possible experience for the user"
            )
            exit(1)
        else:
            print(
                f"{domain} is added to https://github.com/home-assistant/brands, NICE!"
            )
예제 #3
0
async def check():
    print("Information: https://hacs.xyz/docs/publish/include#check-brands")
    if get_category() != "integration":
       print("Only integrations are checked.")
       return

    manifest = get_manifest()
    domain = manifest.get("domain")

    if domain is None:
        print("No domain")
        exit(1)

    async with GitHub(TOKEN) as github:
        repository = await github.get_repo("home-assistant/brands")
        core = await repository.get_contents("core_integrations")
        custom = await repository.get_contents("custom_integrations")

        if domain not in [x.attributes["name"] for x in core + custom]:
            exit(
                f"::error::{domain} is not added to https://github.com/home-assistant/brands, "
                + "this is needed to ensure the best possible experience for the user"
            )
        else:
            print(
                f"{domain} is added to https://github.com/home-assistant/brands, NICE!"
            )
예제 #4
0
def check():
    print("Information: https://hacs.xyz/docs/publish/include#check-manifest")
    if get_category() != "integration":
        print("Only integrations are checked.")
        return

    manifest = get_manifest()
    issues = []

    if manifest.get("domain") is None or manifest.get("domain") == "":
        issues.append("No domain")

    if manifest.get("documentation") is None or manifest.get("documentation") == "":
        issues.append("No documentation")

    if manifest.get("issue_tracker") is None or manifest.get("issue_tracker") == "":
        issues.append("No issue_tracker")

    if manifest.get("codeowners") is None:
        issues.append("No codeowners")

    if manifest.get("homeassistant"):
        issues.append("homeassistant is not valid here")

    if issues:
        for issue in issues:
            print(issue)
        exit(1)
예제 #5
0
def check():
    print("Information: https://hacs.xyz/docs/publish/include#check-manifest")
    if get_category() != "integration":
        print("Only integrations are checked.")
        return

    fail = "::error::Missing required value for key '{key}' in {path}"
    integration = get_integration_path()
    path = f"{integration.replace('/tmp/repositories/addition/', '')}/manifest.json"

    manifest = get_manifest()
    issues = []

    if manifest.get("domain") is None or manifest.get("domain") == "":
        issues.append(fail.format(key="domain", path=path))

    if manifest.get("documentation") is None or manifest.get("documentation") == "":
        issues.append(fail.format(key="documentation", path=path))

    if manifest.get("issue_tracker") is None or manifest.get("issue_tracker") == "":
        issues.append(fail.format(key="issue_tracker", path=path))

    if manifest.get("codeowners") is None:
        issues.append(fail.format(key="codeowners", path=path))

    if issues:
        for issue in issues:
            print(issue)
        exit(1)
예제 #6
0
async def check():
    print("Information: https://hacs.xyz/docs/publish/include#check-wheels")
    if get_category() != "integration":
        print("Only integrations are checked.")
        return

    manifest = get_manifest()

    domain = manifest.get("domain")
    requirements = manifest.get("requirements")
    if domain is None:
        exit("No domain")

    if not requirements:
        print("No requirements found")
        return

    async with GitHub(TOKEN) as github:
        repository = await github.get_repo(
            "home-assistant/wheels-custom-integrations")
        files = await repository.get_contents("components")
        components = [x.attributes["name"] for x in files]
        if domain in components or f"{domain}.json" in components:
            print(
                f"{domain} is added to https://github.com/home-assistant/wheels-custom-integrations, NICE!"
            )
            return
        exit(
            f"::error::{domain} is not added to https://github.com/home-assistant/wheels-custom-integrations, "
            +
            "this is needed to ensure the best possible experience for the user"
        )
예제 #7
0
def check():
    print("Information: https://hacs.xyz/docs/publish/include#check-images")
    if get_category() not in ["plugin", "theme"]:
        print("Only plugin and theme are checked.")
        return

    info = get_info()
    if "<img" in info or "![" in info:
        print("Has image(s)")
        return

    exit("::error::There should be images to show the user what they get.")
예제 #8
0
def check():
    if get_category() not in ["plugin", "theme"]:
        print("Only plugin and theme are checked.")
        return

    info = get_info()
    if "<img" in info or "![" in info:
        print("Has image(s)")
        return

    print("There should be images to show the user what they get.")
    exit(1)
예제 #9
0
def check():
    if get_category() != "integration":
        print("Only integrations are checked.")
        return

    manifest = get_hacs_manifest()
    issues = []

    if manifest.get("name") is None:
        issues.append("No name")

    if issues:
        for issue in issues:
            print(issue)
        exit(1)
예제 #10
0
파일: repo.py 프로젝트: laszlojakab/default
def get_repo():
    category = get_category()
    with open(f"{DEFAULT}/{category}", "r") as default:
        current = json.loads(default.read())

    with open(category, "r") as default:
        new = json.loads(default.read())

    for repo in current:
        if repo in new:
            new.remove(repo)

    if len(new) != 1:
        print(f"Bad data {new}")
        exit(1)

    return new.pop()
예제 #11
0
def check():
    print(
        "Information: https://hacs.xyz/docs/publish/include#check-hacs-manifest"
    )
    if get_category() != "integration":
        print("Only integrations are checked.")
        return

    manifest = get_hacs_manifest()
    issues = []

    if manifest.get("name") is None:
        issues.append("No name")

    if issues:
        for issue in issues:
            print(issue)
        exit(1)
예제 #12
0
def check():
    print(
        "Information: https://hacs.xyz/docs/publish/include#check-hacs-manifest"
    )
    if get_category() != "integration":
        print("Only integrations are checked.")
        return

    manifest = get_hacs_manifest()
    fail = "::error::Missing required value for key '{key}' in {path}"
    path = "hacs.json"
    issues = []

    if manifest.get("name") is None:
        issues.append(fail.format(key="name", path=path))

    if issues:
        for issue in issues:
            print(issue)
        exit(1)