Update exit codes

This commit is contained in:
ludeeus
2020-05-27 16:41:57 +00:00
parent 5ce5735a12
commit 51639d6624
9 changed files with 25 additions and 18 deletions
+2 -1
View File
@@ -17,7 +17,8 @@ async def check():
repo = repository.attributes
if repo["archived"]:
exit(1)
exit("Repository is archived")
if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(check())
+4 -3
View File
@@ -28,9 +28,10 @@ async def check():
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)
exit(
f"{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!"
+2 -1
View File
@@ -17,7 +17,8 @@ async def check():
repo = repository.attributes
if repo["fork"]:
exit(1)
exit(78)
if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(check())
+2 -1
View File
@@ -24,7 +24,8 @@ async def check():
print(f"{ACTOR} is the owner of the repository")
return
exit(1)
exit(78)
if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(check())
+3 -2
View File
@@ -17,12 +17,13 @@ async def check():
repository = await github.get_repo(repo)
repo = repository.attributes
if not repo["has_issues"]:
issues.append("Issues not enabled.")
if not repo["description"]:
issues.append("No description. (https://hacs.xyz/docs/publish/start#description)")
issues.append(
"No description. (https://hacs.xyz/docs/publish/start#description)"
)
if not repo["topics"]:
issues.append("No topics. (https://hacs.xyz/docs/publish/start#topics)")
+4 -6
View File
@@ -22,8 +22,7 @@ async def check():
domain = manifest.get("domain")
requirements = manifest.get("requirements")
if domain is None:
print("No domain")
exit(1)
exit("No domain")
if not requirements:
print("No requirements found")
@@ -38,11 +37,10 @@ async def check():
f"{domain} is added to https://github.com/home-assistant/wheels-custom-integrations, NICE!"
)
return
print(
f"{domain} is not added to https://github.com/home-assistant/wheels-custom-integrations"
exit(
f"{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"
)
print("This is needed to ensure the best possible experience for the user")
exit(1)
if __name__ == "__main__":
+3 -2
View File
@@ -3,10 +3,11 @@ import os
from glob import glob
from scripts.helpers.manifest import get_manifest
def get_domain():
manifest = get_manifest()
return manifest.get('domain')
return manifest.get("domain")
if __name__ == "__main__":
print(get_domain())
print(get_domain())
+3 -1
View File
@@ -2,6 +2,7 @@ import json
import os
from glob import glob
def get_integration_path():
files = []
for dir, _, _ in os.walk("/tmp/addition"):
@@ -12,5 +13,6 @@ def get_integration_path():
exit(1)
return files.pop().replace("/manifest.json", "")
if __name__ == "__main__":
print(get_integration_path())
print(get_integration_path())
+2 -1
View File
@@ -3,9 +3,10 @@ import os
from glob import glob
from scripts.helpers.integration_path import get_integration_path
def get_manifest():
manifest = f"{get_integration_path()}/manifest.json"
with open(manifest, "r") as mf:
manifest = json.loads(mf.read())
return manifest or {}
return manifest or {}