mirror of https://github.com/google/oss-fuzz.git
Update pr_helper criticality score (#10566)
Update repo_url as criticality score does not support url ends with '.git'. Example: ~/go/bin$ `./criticality_score --format json -gcp-project-id=clusterfuzz-external https://github.com/kubernetes/kubernetes.git` 2023-06-21 14:27:39.583 INFO Preparing default scorer 2023-06-21 14:27:41.007 INFO deps.dev signal source enabled `2023-06-21 14:27:41.869 WARN Repo cannot be collected {"worker": 0, "url": "https://github.com/kubernetes/kubernetes.git", "error": "repo failed: not found: https://github.com/kubernetes/kubernetes.git"}` --------- Co-authored-by: Dongge Liu <alan32.liu@gmail.com>
This commit is contained in:
parent
71b357c4f3
commit
123e5980b5
|
@ -35,6 +35,9 @@ CRITICALITY_SCORE_PATH = '/home/runner/go/bin/criticality_score'
|
|||
|
||||
def get_criticality_score(repo_url):
|
||||
"""Gets the criticality score of the project."""
|
||||
# Criticality score does not support repo url ends with '.git'
|
||||
if repo_url.endswith('.git'):
|
||||
repo_url = repo_url[:-4]
|
||||
report = subprocess.run([
|
||||
CRITICALITY_SCORE_PATH, '--format', 'json',
|
||||
'-gcp-project-id=clusterfuzz-external', '-depsdev-disable', repo_url
|
||||
|
@ -42,7 +45,12 @@ def get_criticality_score(repo_url):
|
|||
capture_output=True,
|
||||
text=True)
|
||||
|
||||
report_dict = json.loads(report.stdout)
|
||||
try:
|
||||
report_dict = json.loads(report.stdout)
|
||||
except:
|
||||
print(f'Criticality score failed with stdout: {report.stdout}')
|
||||
print(f'Criticality score failed with stderr: {report.stderr}')
|
||||
return 'N/A'
|
||||
return report_dict.get('default_score', 'N/A')
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue