fix discord emojis. fix final message small details.
This commit is contained in:
38
PICable.py
38
PICable.py
@@ -65,46 +65,52 @@ def PICable(owner, repository, token):
|
|||||||
stars = get_stars_info(owner, repository, token)
|
stars = get_stars_info(owner, repository, token)
|
||||||
|
|
||||||
if stars == -1:
|
if stars == -1:
|
||||||
return "The repository does not exist or the token is invalid. ❌"
|
return "The repository does not exist or the token is invalid. :x:"
|
||||||
|
|
||||||
if stars >= LIMIT_STARS:
|
if stars >= LIMIT_STARS:
|
||||||
res += f"The repository has over {LIMIT_STARS} stars. ✅\n"
|
res += f"The repository has at least {LIMIT_STARS} stars. :white_check_mark:\n"
|
||||||
elif stars >= LIMIT_STARS * (1 - MARGIN):
|
elif stars >= LIMIT_STARS * (1 - MARGIN):
|
||||||
res += f"The repository has {stars}, which is close to the limit of {LIMIT_STARS} stars, considering a {margin_percentage}% margin. ⭕\n"
|
res += f"The repository has {stars}, which is close to the limit of {LIMIT_STARS} stars, considering a {margin_percentage}% margin. :warning:\n"
|
||||||
else:
|
else:
|
||||||
res += f"The repository has {stars} stars, which is way below the limit of {LIMIT_STARS} stars, considering a {margin_percentage}% margin. ❌\n"
|
res += f"The repository has {stars} stars, which is way below the limit of {LIMIT_STARS} stars, considering a {margin_percentage}% margin. :x:\n"
|
||||||
|
|
||||||
commits_30_days = get_commits_last_30_days(owner, repository, token)
|
commits_30_days = get_commits_last_30_days(owner, repository, token)
|
||||||
|
|
||||||
if commits_30_days == -1:
|
if commits_30_days == -1:
|
||||||
return "The repository does not exist or the token is invalid. ❌"
|
return "The repository does not exist or the token is invalid. :x:"
|
||||||
|
|
||||||
if commits_30_days >= LIMIT_COMMITS_30_DAYS:
|
if commits_30_days >= LIMIT_COMMITS_30_DAYS:
|
||||||
res += f"The repository has over {LIMIT_COMMITS_30_DAYS} commits in the last 30 days. ✅\n"
|
res += f"The repository has at least {LIMIT_COMMITS_30_DAYS} commits in the last 30 days. :white_check_mark:\n"
|
||||||
elif commits_30_days >= LIMIT_COMMITS_30_DAYS * (1 - MARGIN):
|
elif commits_30_days >= LIMIT_COMMITS_30_DAYS * (1 - MARGIN):
|
||||||
res += f"The repository has {commits_30_days} commits in the last 30 days, which is close to the limit of {LIMIT_COMMITS_30_DAYS} commits, considering a {margin_percentage}% margin. ⭕\n"
|
res += f"The repository has {commits_30_days} commits in the last 30 days, which is close to the limit of {LIMIT_COMMITS_30_DAYS} commits, considering a {margin_percentage}% margin. :warning:\n"
|
||||||
else:
|
else:
|
||||||
res += f"The repository has {commits_30_days} commits in the last 30 days, which is way below the limit of {LIMIT_COMMITS_30_DAYS} commits, considering a {margin_percentage}% margin. ❌\n"
|
res += f"The repository has {commits_30_days} commits in the last 30 days, which is way below the limit of {LIMIT_COMMITS_30_DAYS} commits, considering a {margin_percentage}% margin. :x:\n"
|
||||||
|
|
||||||
nloc = get_lines_of_code(owner, repository)
|
nloc = get_lines_of_code(owner, repository)
|
||||||
|
|
||||||
if nloc == -1:
|
if nloc == -1:
|
||||||
return "The repository does not exist. ❌"
|
return "The repository does not exist. :x:"
|
||||||
|
|
||||||
if nloc >= LIMIT_NLOC:
|
if nloc >= LIMIT_NLOC:
|
||||||
res += f"The repository has over {LIMIT_NLOC} lines of code. ✅\n"
|
res += f"The repository has at least {LIMIT_NLOC} lines of code. :white_check_mark:\n"
|
||||||
elif nloc >= LIMIT_NLOC * (1 - MARGIN):
|
elif nloc >= LIMIT_NLOC * (1 - MARGIN):
|
||||||
res += f"The repository has {nloc} lines of code, which is close to the limit of {LIMIT_NLOC} lines of code, considering a {margin_percentage}% margin. ⭕\n"
|
res += f"The repository has {nloc} lines of code, which is close to the limit of {LIMIT_NLOC} lines of code, considering a {margin_percentage}% margin. :warning:\n"
|
||||||
else:
|
else:
|
||||||
res += f"The repository has {nloc} lines of code, which is way below the limit of {LIMIT_NLOC} lines of code, considering a {margin_percentage}% margin. ❌\n"
|
res += f"The repository has {nloc} lines of code, which is way below the limit of {LIMIT_NLOC} lines of code, considering a {margin_percentage}% margin. :x:\n"
|
||||||
|
|
||||||
res += "\n"
|
res += "\n"
|
||||||
|
|
||||||
if any([stars < LIMIT_STARS * (1 - MARGIN), commits_30_days < LIMIT_COMMITS_30_DAYS * (1 - MARGIN), nloc < LIMIT_NLOC * (1 - MARGIN)]):
|
if any(
|
||||||
res += f"The repository {owner}/{repository} is not PICable. There are some requirements that are way below the requested limits. ❌\n"
|
[
|
||||||
|
stars < LIMIT_STARS * (1 - MARGIN),
|
||||||
|
commits_30_days < LIMIT_COMMITS_30_DAYS * (1 - MARGIN),
|
||||||
|
nloc < LIMIT_NLOC * (1 - MARGIN),
|
||||||
|
]
|
||||||
|
):
|
||||||
|
res += f"The repository {owner}/{repository} is not PICable. There are some requirements that are way below the requested limits. :x:\n"
|
||||||
elif all([stars >= LIMIT_STARS, commits_30_days >= LIMIT_COMMITS_30_DAYS, nloc >= LIMIT_NLOC]):
|
elif all([stars >= LIMIT_STARS, commits_30_days >= LIMIT_COMMITS_30_DAYS, nloc >= LIMIT_NLOC]):
|
||||||
res += f"The repository {owner}/{repository} is PICable. ✅\n"
|
res += f"The repository {owner}/{repository} is PICable. :white_check_mark:\n"
|
||||||
else:
|
else:
|
||||||
res += f"The repository {owner}/{repository} is almost PICable. There are certain requirements which are almost met by this repository. Consult with a professor before proceeding. ⭕\n"
|
res += f"The repository {owner}/{repository} is almost PICable. There are certain requirements which are almost met by this repository. Consult with a professor before proceeding. :warning:\n"
|
||||||
|
|
||||||
return res
|
return res
|
||||||
Reference in New Issue
Block a user