feat: Enhance link generation for relevant lines and refactor code in git providers and PR description tools

This commit is contained in:
mrT23
2023-12-04 21:06:56 +02:00
parent d2a129fe30
commit 21a7a0f136
5 changed files with 22 additions and 10 deletions

View File

@ -424,7 +424,9 @@ class GitLabProvider(GitProvider):
return ""
def get_line_link(self, relevant_file: str, relevant_line_start: int, relevant_line_end: int = None) -> str:
if relevant_line_end:
if relevant_line_start == -1:
link = f"https://gitlab.com/codiumai/pr-agent/-/blob/{self.mr.source_branch}/{relevant_file}?ref_type=heads"
elif relevant_line_end:
link = f"https://gitlab.com/codiumai/pr-agent/-/blob/{self.mr.source_branch}/{relevant_file}?ref_type=heads#L{relevant_line_start}-L{relevant_line_end}"
else:
link = f"https://gitlab.com/codiumai/pr-agent/-/blob/{self.mr.source_branch}/{relevant_file}?ref_type=heads#L{relevant_line_start}"