diff --git a/Usage.md b/Usage.md index e80fea7b..9f4af800 100644 --- a/Usage.md +++ b/Usage.md @@ -122,6 +122,13 @@ keep_original_user_title = false ``` When a new PR is opened, PR-Agent will run the `describe` tool with the above parameters. +To cancel the automatic run of all the tools, set: +``` +[github_app] +pr_commands = [] +``` + + Note that a local `.pr_agent.toml` file enables you to edit and customize the default parameters of any tool, not just the ones that are run automatically. #### Editing the prompts diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index c7923d16..6460c31d 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -99,6 +99,8 @@ def parse_code_suggestion(code_suggestions: dict) -> str: markdown_text += f"\n - **{sub_key}:** {sub_value}\n" else: markdown_text += f" **{sub_key}:** {sub_value}\n" + if "relevant line" not in sub_key.lower(): # nicer presentation + markdown_text = markdown_text.rstrip('\n') + "\\\n" markdown_text += "\n" return markdown_text diff --git a/pr_agent/git_providers/gitlab_provider.py b/pr_agent/git_providers/gitlab_provider.py index 33cbee2b..350efcfc 100644 --- a/pr_agent/git_providers/gitlab_provider.py +++ b/pr_agent/git_providers/gitlab_provider.py @@ -175,8 +175,7 @@ class GitLabProvider(GitProvider): pos_obj['new_line'] = target_line_no - 1 pos_obj['old_line'] = source_line_no - 1 logging.debug(f"Creating comment in {self.id_mr} with body {body} and position {pos_obj}") - self.mr.discussions.create({'body': body, - 'position': pos_obj}) + self.mr.discussions.create({'body': body, 'position': pos_obj}) def get_relevant_diff(self, relevant_file: str, relevant_line_in_file: int) -> Optional[dict]: changes = self.mr.changes() # Retrieve the changes for the merge request once diff --git a/pr_agent/tools/pr_code_suggestions.py b/pr_agent/tools/pr_code_suggestions.py index 7f0b1264..e1d5206c 100644 --- a/pr_agent/tools/pr_code_suggestions.py +++ b/pr_agent/tools/pr_code_suggestions.py @@ -138,9 +138,9 @@ class PRCodeSuggestions: if get_settings().config.verbosity_level >= 2: logging.info(f"Could not parse suggestion: {d}") - is_successful = self.git_provider.publish_code_suggestions(code_suggestions) - if not is_successful: - logging.info("Failed to publish code suggestions, trying to publish each suggestion separately") + # is_successful = self.git_provider.publish_code_suggestions(code_suggestions) + if True: + # logging.info("Failed to publish code suggestions, trying to publish each suggestion separately") for code_suggestion in code_suggestions: self.git_provider.publish_code_suggestions([code_suggestion])