diff --git a/README.md b/README.md index 7a8cbf06..0728bbce 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ To set up your own PR-Agent, see the [Quickstart](#Quickstart) section | TOOLS | Review | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | ⮑ Inline review | :white_check_mark: | :white_check_mark: | | | | Ask | :white_check_mark: | :white_check_mark: | | -| | Auto-Description | :white_check_mark: | | | +| | Auto-Description | :white_check_mark: | :white_check_mark: | | | | Improve Code | :white_check_mark: | :white_check_mark: | | | | Reflect and Review | :white_check_mark: | | | | | | | | | diff --git a/pr_agent/algo/pr_processing.py b/pr_agent/algo/pr_processing.py index a57b0e4b..165b7de5 100644 --- a/pr_agent/algo/pr_processing.py +++ b/pr_agent/algo/pr_processing.py @@ -29,10 +29,10 @@ def get_pr_diff(git_provider: Union[GithubProvider, Any], token_handler: TokenHa global PATCH_EXTRA_LINES PATCH_EXTRA_LINES = 0 - git_provider.pr.diff_files = list(git_provider.get_diff_files()) + diff_files = list(git_provider.get_diff_files()) # get pr languages - pr_languages = sort_files_by_main_languages(git_provider.get_languages(), git_provider.pr.diff_files) + pr_languages = sort_files_by_main_languages(git_provider.get_languages(), diff_files) # generate a standard diff string, with patch extension patches_extended, total_tokens = pr_generate_extended_diff(pr_languages, token_handler, diff --git a/pr_agent/git_providers/github_provider.py b/pr_agent/git_providers/github_provider.py index a04f550a..23d2b605 100644 --- a/pr_agent/git_providers/github_provider.py +++ b/pr_agent/git_providers/github_provider.py @@ -70,7 +70,7 @@ class GithubProvider(GitProvider): if relevant_line_in_file in line: position = i break - elif relevant_line_in_file[0] == '+' and relevant_line_in_file[1:] in line: + elif relevant_line_in_file[0] == '+' and relevant_line_in_file[1:].lstrip() in line: # The model often adds a '+' to the beginning of the relevant_line_in_file even if originally # it's a context line position = i diff --git a/pr_agent/git_providers/gitlab_provider.py b/pr_agent/git_providers/gitlab_provider.py index c3161dfb..25911825 100644 --- a/pr_agent/git_providers/gitlab_provider.py +++ b/pr_agent/git_providers/gitlab_provider.py @@ -87,8 +87,12 @@ class GitLabProvider(GitProvider): return [change['new_path'] for change in self.mr.changes()['changes']] def publish_description(self, pr_title: str, pr_body: str): - logging.exception("Not implemented yet") - pass + try: + self.mr.title = pr_title + self.mr.description = pr_body + self.mr.save() + except Exception as e: + logging.exception(f"Could not update merge request {self.id_mr} description: {e}") def publish_comment(self, mr_comment: str, is_temporary: bool = False): comment = self.mr.notes.create({'body': mr_comment}) @@ -187,7 +191,7 @@ class GitLabProvider(GitProvider): found = True edit_type = self.get_edit_type(line) break - elif relevant_line_in_file[0] == '+' and relevant_line_in_file[1:] in line: + elif relevant_line_in_file[0] == '+' and relevant_line_in_file[1:].lstrip() in line: # The model often adds a '+' to the beginning of the relevant_line_in_file even if originally # it's a context line found = True diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index 542e50b6..4f6fde74 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -96,7 +96,7 @@ class PRReviewer: del data['PR Feedback']['Security concerns'] data['PR Analysis']['Security concerns'] = val - if settings.config.git_provider == 'github' and \ + if settings.config.git_provider != 'bitbucket' and \ settings.pr_reviewer.inline_code_comments and \ 'Code suggestions' in data['PR Feedback']: # keeping only code suggestions that can't be submitted as inline comments