remove test. fix if clause structure.

This commit is contained in:
Enzo Nunes
2025-02-25 11:39:13 +00:00
parent 05f5de2d70
commit 2731dbf995

View File

@@ -52,9 +52,12 @@ def get_lines_of_code(owner, repository):
try: try:
subprocess.run( subprocess.run(
["git", "clone", repo_url, repository_clone_dir], check=True, stdout=sys.stdout, stderr=sys.stderr ["git", "clone", repo_url, repository_clone_dir],
check=True,
stdout=sys.stdout,
stderr=sys.stderr,
) )
except: except Exception:
return -1 return -1
result = subprocess.run(["sloccount", repository_clone_dir], capture_output=True, text=True, check=True) result = subprocess.run(["sloccount", repository_clone_dir], capture_output=True, text=True, check=True)
@@ -126,12 +129,9 @@ def PICable(owner, repository, token):
or lines_of_code < LIMIT_NLOC * (1 - MARGIN) or lines_of_code < LIMIT_NLOC * (1 - MARGIN)
): ):
picable_report += f"The repository {repository_url} is not PICable. :x:\nThere is at least one requirement which is more than {margin_percentage}% below the requirement.\n" picable_report += f"The repository {repository_url} is not PICable. :x:\nThere is at least one requirement which is more than {margin_percentage}% below the requirement.\n"
elif all([stars >= LIMIT_STARS, commits_30_days >= LIMIT_COMMITS_30_DAYS, lines_of_code >= LIMIT_NLOC]): elif stars >= LIMIT_STARS and commits_30_days >= LIMIT_COMMITS_30_DAYS and lines_of_code >= LIMIT_NLOC:
picable_report += f"The repository {repository_url} is PICable. :white_check_mark:\n" picable_report += f"The repository {repository_url} is PICable. :white_check_mark:\n"
else: else:
picable_report += f"The repository {repository_url} is almost PICable. :warning:\nThere is at least one requirement which is below the requirement, but by less than {margin_percentage}%. Consult with a professor before proceeding.\n" picable_report += f"The repository {repository_url} is almost PICable. :warning:\nThere is at least one requirement which is below the requirement, but by less than {margin_percentage}%. Consult with a professor before proceeding.\n"
return picable_report return picable_report
print(PICable("numpy", "numpy", "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"))