Skip to content

Commit fefeae2

Browse files
committed
Unifying output related to repository name uniqueness and fixing a minor bug in its output.
1 parent 34e375c commit fefeae2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/gitxray/xrays/repository_xray.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ def run(gx_context, gx_output, gh_api):
1616
most_rated = similar_names.get('items')[0]
1717
search_url = f"https://github.com/search?q={repository.get('name')}%20in:name&type=repositories&s=stars&o=desc"
1818
if most_rated.get('full_name') == repository.get('full_name'):
19-
gx_output.r_log(f"This is the highest rating repository with name [{repository.get('name')}]", rtype="profiling")
19+
reponame_msg = f"This is the highest rating repository with name [{repository.get('name')}]"
2020
else:
21-
gx_output.r_log(f"WARNING: This is NOT the highest rating repository with name [{repository.get('name')}]", rtype="profiling")
21+
reponame_msg = f"WARNING: This is NOT the highest rating repository with name [{repository.get('name')}]"
2222

23-
if similar_names.get('total_count') > 1:
24-
gx_output.r_log(f'{similar_names.get("total_count")} repositories with a similar name were discovered - See them here: {search_url}', 'profiling')
23+
if similar_names.get('total_count') > 0:
24+
gx_output.r_log(f'{reponame_msg}. {similar_names.get("total_count")} repositories with a similar name were discovered - See them here: {search_url}', 'profiling')
25+
else:
26+
gx_output.r_log(f'{reponame_msg}', 'profiling')
2527

2628
stargazers_message = f"Stars count: [{repository.get('stargazers_count')}]"
2729
if repository.get('stargazers_count') > 0:

0 commit comments

Comments
 (0)